Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions policy-test/tests/e2e_egress_network.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use linkerd_policy_controller_k8s_api::{self as k8s, gateway};
use linkerd_policy_test::{
assert_status_accepted, await_condition, await_egress_net_status, await_gateway_route_status,
await_tcp_route_status, await_tls_route_status, create, create_ready_pod, curl,
endpoints_ready, web, with_temp_ns, LinkerdInject,
create, create_ready_pod, curl, endpoints_ready, web, with_temp_ns, LinkerdInject,
};
#[cfg(feature = "gateway-api-experimental")]
use linkerd_policy_test::{await_tcp_route_status, await_tls_route_status};

#[tokio::test(flavor = "current_thread")]
async fn default_traffic_policy_http_allow() {
Expand Down Expand Up @@ -253,6 +254,7 @@ async fn explicit_allow_http_route() {
.await;
}

#[cfg(feature = "gateway-api-experimental")]
#[tokio::test(flavor = "current_thread")]
async fn explicit_allow_tls_route() {
with_temp_ns(|client, ns| async move {
Expand Down Expand Up @@ -357,6 +359,7 @@ async fn explicit_allow_tls_route() {
.await;
}

#[cfg(feature = "gateway-api-experimental")]
#[tokio::test(flavor = "current_thread")]
async fn explicit_allow_tcp_route() {
with_temp_ns(|client, ns| async move {
Expand Down Expand Up @@ -564,6 +567,7 @@ async fn routing_back_to_cluster_http_route() {
.await;
}

#[cfg(feature = "gateway-api-experimental")]
#[tokio::test(flavor = "current_thread")]
async fn routing_back_to_cluster_tls_route() {
with_temp_ns(|client, ns| async move {
Expand Down Expand Up @@ -655,6 +659,7 @@ async fn routing_back_to_cluster_tls_route() {
.await;
}

#[cfg(feature = "gateway-api-experimental")]
#[tokio::test(flavor = "current_thread")]
async fn routing_back_to_cluster_tcp_route() {
with_temp_ns(|client, ns| async move {
Expand Down
75 changes: 51 additions & 24 deletions policy-test/tests/outbound_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,16 @@ async fn routes_with_backend() {
test::<k8s::Service, gateway::HTTPRoute>().await;
test::<k8s::Service, policy::HttpRoute>().await;
test::<k8s::Service, gateway::GRPCRoute>().await;
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
test::<policy::EgressNetwork, gateway::HTTPRoute>().await;
test::<policy::EgressNetwork, policy::HttpRoute>().await;
test::<policy::EgressNetwork, gateway::GRPCRoute>().await;
test::<policy::EgressNetwork, gateway::TLSRoute>().await;
test::<policy::EgressNetwork, gateway::TCPRoute>().await;
#[cfg(feature = "gateway-api-experimental")]
{
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
test::<policy::EgressNetwork, gateway::TLSRoute>().await;
test::<policy::EgressNetwork, gateway::TCPRoute>().await;
}
}

#[tokio::test(flavor = "current_thread")]
Expand Down Expand Up @@ -390,8 +393,11 @@ async fn service_with_routes_with_cross_namespace_backend() {
test::<k8s::Service, gateway::HTTPRoute>().await;
test::<k8s::Service, policy::HttpRoute>().await;
test::<k8s::Service, gateway::GRPCRoute>().await;
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
#[cfg(feature = "gateway-api-experimental")]
{
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
}
}

#[tokio::test(flavor = "current_thread")]
Expand Down Expand Up @@ -473,13 +479,16 @@ async fn routes_with_invalid_backend() {
test::<k8s::Service, gateway::HTTPRoute>().await;
test::<k8s::Service, policy::HttpRoute>().await;
test::<k8s::Service, gateway::GRPCRoute>().await;
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
test::<policy::EgressNetwork, gateway::HTTPRoute>().await;
test::<policy::EgressNetwork, policy::HttpRoute>().await;
test::<policy::EgressNetwork, gateway::GRPCRoute>().await;
test::<policy::EgressNetwork, gateway::TLSRoute>().await;
test::<policy::EgressNetwork, gateway::TCPRoute>().await;
#[cfg(feature = "gateway-api-experimental")]
{
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
test::<policy::EgressNetwork, gateway::TLSRoute>().await;
test::<policy::EgressNetwork, gateway::TCPRoute>().await;
}
}

#[tokio::test(flavor = "current_thread")]
Expand Down Expand Up @@ -573,11 +582,14 @@ async fn multiple_routes() {
test::<k8s::Service, gateway::HTTPRoute>().await;
test::<k8s::Service, policy::HttpRoute>().await;
test::<k8s::Service, gateway::GRPCRoute>().await;
test::<k8s::Service, gateway::TLSRoute>().await;
test::<policy::EgressNetwork, gateway::HTTPRoute>().await;
test::<policy::EgressNetwork, policy::HttpRoute>().await;
test::<policy::EgressNetwork, gateway::GRPCRoute>().await;
test::<policy::EgressNetwork, gateway::TLSRoute>().await;
#[cfg(feature = "gateway-api-experimental")]
{
test::<k8s::Service, gateway::TLSRoute>().await;
test::<policy::EgressNetwork, gateway::TLSRoute>().await;
}
}

#[tokio::test(flavor = "current_thread")]
Expand Down Expand Up @@ -713,8 +725,11 @@ async fn route_with_no_port() {
test::<k8s::Service, gateway::HTTPRoute>().await;
test::<k8s::Service, policy::HttpRoute>().await;
test::<k8s::Service, gateway::GRPCRoute>().await;
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
#[cfg(feature = "gateway-api-experimental")]
{
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
}
}

#[tokio::test(flavor = "current_thread")]
Expand Down Expand Up @@ -812,8 +827,11 @@ async fn producer_route() {
test::<k8s::Service, gateway::HTTPRoute>().await;
test::<k8s::Service, policy::HttpRoute>().await;
test::<k8s::Service, gateway::GRPCRoute>().await;
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
#[cfg(feature = "gateway-api-experimental")]
{
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
}
}

#[tokio::test(flavor = "current_thread")]
Expand Down Expand Up @@ -887,8 +905,11 @@ async fn pre_existing_producer_route() {
test::<k8s::Service, gateway::HTTPRoute>().await;
test::<k8s::Service, policy::HttpRoute>().await;
test::<k8s::Service, gateway::GRPCRoute>().await;
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
#[cfg(feature = "gateway-api-experimental")]
{
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
}
}

#[tokio::test(flavor = "current_thread")]
Expand Down Expand Up @@ -1015,8 +1036,11 @@ async fn consumer_route() {
test::<k8s::Service, gateway::HTTPRoute>().await;
test::<k8s::Service, policy::HttpRoute>().await;
test::<k8s::Service, gateway::GRPCRoute>().await;
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
#[cfg(feature = "gateway-api-experimental")]
{
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
}
}

#[tokio::test(flavor = "current_thread")]
Expand Down Expand Up @@ -1109,11 +1133,14 @@ async fn route_reattachment() {
test::<k8s::Service, gateway::HTTPRoute>().await;
test::<k8s::Service, policy::HttpRoute>().await;
test::<k8s::Service, gateway::GRPCRoute>().await;
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
test::<policy::EgressNetwork, gateway::HTTPRoute>().await;
test::<policy::EgressNetwork, policy::HttpRoute>().await;
test::<policy::EgressNetwork, gateway::GRPCRoute>().await;
test::<policy::EgressNetwork, gateway::TLSRoute>().await;
test::<policy::EgressNetwork, gateway::TCPRoute>().await;
#[cfg(feature = "gateway-api-experimental")]
{
test::<k8s::Service, gateway::TLSRoute>().await;
test::<k8s::Service, gateway::TCPRoute>().await;
test::<policy::EgressNetwork, gateway::TLSRoute>().await;
test::<policy::EgressNetwork, gateway::TCPRoute>().await;
}
}
5 changes: 3 additions & 2 deletions policy-test/tests/outbound_api_app_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ use linkerd_policy_test::{
assert_resource_meta, create,
outbound_api::{
assert_route_is_default, assert_singleton, http1_routes, http2_routes,
retry_watch_outbound_policy, tcp_routes,
retry_watch_outbound_policy,
},
test_route::TestParent,
with_temp_ns,
};

#[cfg(feature = "gateway-api-experimental")]
#[tokio::test(flavor = "current_thread")]
async fn opaque_parent() {
async fn test<P: TestParent>() {
Expand All @@ -37,7 +38,7 @@ async fn opaque_parent() {

assert_resource_meta(&config.metadata, parent.obj_ref(), port);

let routes = tcp_routes(&config);
let routes = linkerd_policy_test::outbound_api::tcp_routes(&config);
let route = assert_singleton(routes);
assert_route_is_default::<gateway::TCPRoute>(route, &parent.obj_ref(), port);
})
Expand Down
2 changes: 2 additions & 0 deletions policy-test/tests/outbound_api_tcp.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(feature = "gateway-api-experimental")]

use futures::StreamExt;
use linkerd_policy_controller_k8s_api::{self as k8s, gateway, policy};
use linkerd_policy_test::{
Expand Down