From 524bf66cbc8c9c69e7bdd769d0ee16e1709ff529 Mon Sep 17 00:00:00 2001 From: Dan Mihai Date: Thu, 18 Sep 2025 21:52:51 +0000 Subject: [PATCH] tests: k8s-credentials-secrets: retry on exec error Retry after "kubectl exec" failure, instead of aborting the test immediately. Example of recent error: https://github.com/kata-containers/kata-containers/actions/runs/17828061309/job/50693999052?pr=11822 not ok 1 Credentials using secrets (in test file k8s-credentials-secrets.bats, line 59) `kubectl exec $pod_name -- "${pod_exec_command[@]}" | grep -w "username"' failed Signed-off-by: Dan Mihai --- tests/integration/kubernetes/k8s-credentials-secrets.bats | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/integration/kubernetes/k8s-credentials-secrets.bats b/tests/integration/kubernetes/k8s-credentials-secrets.bats index 7035c70fb9..dcc52093e8 100644 --- a/tests/integration/kubernetes/k8s-credentials-secrets.bats +++ b/tests/integration/kubernetes/k8s-credentials-secrets.bats @@ -55,8 +55,8 @@ setup() { kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name" # List the files - kubectl exec $pod_name -- "${pod_exec_command[@]}" | grep -w "password" - kubectl exec $pod_name -- "${pod_exec_command[@]}" | grep -w "username" + pod_exec_with_retries "${pod_name}" "${pod_exec_command[@]}" | grep -w "password" + pod_exec_with_retries "${pod_name}" "${pod_exec_command[@]}" | grep -w "username" # Create a pod that has access to the secret data through environment variables kubectl create -f "${pod_env_yaml_file}" @@ -65,8 +65,8 @@ setup() { kubectl wait --for=condition=Ready --timeout=$timeout pod "$second_pod_name" # Display environment variables - kubectl exec $second_pod_name -- "${pod_env_exec_command[@]}" | grep -w "SECRET_USERNAME" - kubectl exec $second_pod_name -- "${pod_env_exec_command[@]}" | grep -w "SECRET_PASSWORD" + pod_exec_with_retries "${second_pod_name}" "${pod_env_exec_command[@]}" | grep -w "SECRET_USERNAME" + pod_exec_with_retries "${second_pod_name}" "${pod_env_exec_command[@]}" | grep -w "SECRET_PASSWORD" } teardown() {