From 4211d93b876a77cde6f4fababfdfb6abd5168406 Mon Sep 17 00:00:00 2001 From: Dan Mihai Date: Tue, 2 Apr 2024 19:41:21 +0000 Subject: [PATCH] tests: k8s-nginx-connectivity.bats policy Use the "allow all" policy for k8s-nginx-connectivity.bats, instead of relying on the Kata Guest image to use the same policy as its default. Signed-off-by: Dan Mihai --- .../kubernetes/k8s-nginx-connectivity.bats | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/integration/kubernetes/k8s-nginx-connectivity.bats b/tests/integration/kubernetes/k8s-nginx-connectivity.bats index bc7271dc86..73c4426fb3 100644 --- a/tests/integration/kubernetes/k8s-nginx-connectivity.bats +++ b/tests/integration/kubernetes/k8s-nginx-connectivity.bats @@ -15,15 +15,19 @@ setup() { deployment="nginx-deployment" get_pod_config_dir + + # Create test .yaml + yaml_file="${pod_config_dir}/test-${deployment}.yaml" + + sed -e "s/\${nginx_version}/${nginx_image}/" \ + "${pod_config_dir}/${deployment}.yaml" > "${yaml_file}" + + add_allow_all_policy_to_yaml "${yaml_file}" } @test "Verify nginx connectivity between pods" { - # Create test .yaml - sed -e "s/\${nginx_version}/${nginx_image}/" \ - "${pod_config_dir}/${deployment}.yaml" > "${pod_config_dir}/test-${deployment}.yaml" - - kubectl create -f "${pod_config_dir}/test-${deployment}.yaml" + kubectl create -f "${yaml_file}" kubectl wait --for=condition=Available --timeout=$timeout deployment/${deployment} kubectl expose deployment/${deployment} @@ -46,7 +50,7 @@ teardown() { kubectl get service/${deployment} -o yaml kubectl get endpoints/${deployment} -o yaml - rm -f "${pod_config_dir}/test-${deployment}.yaml" + rm -f "${yaml_file}" kubectl delete deployment "$deployment" kubectl delete service "$deployment" kubectl delete pod "$busybox_pod"