From 6b065f56099a4580d9688c2ce9ed2159d7cec80f Mon Sep 17 00:00:00 2001 From: Hyounggyu Choi Date: Mon, 17 Jun 2024 14:04:20 +0200 Subject: [PATCH] tests: Use selector rather than pod name for kubectl logs/describe The following error was observed during the deployment of nydus snapshotter: ``` Error from server (NotFound): the server could not find the requested resource ( pods/log nydus-snapshotter-5v82v) 'kubectl logs nydus-snapshotter-5v82v -n nydus-system' failed after 3 tries Error: Process completed with exit code 1. ``` This error can occur when a pod is re-created by a daemonset during the retry interval. This commit addresses the issue by using `--selector` rather than the pod name for `kubectl logs/describe`. Signed-off-by: Hyounggyu Choi --- tests/integration/kubernetes/gha-run.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/integration/kubernetes/gha-run.sh b/tests/integration/kubernetes/gha-run.sh index 2f0ee4d658..71431fa439 100755 --- a/tests/integration/kubernetes/gha-run.sh +++ b/tests/integration/kubernetes/gha-run.sh @@ -532,9 +532,10 @@ function deploy_nydus_snapshotter() { echo "::endgroup::" echo "::group::nydus snapshotter logs" - pods_name=$(kubectl_retry get pods --selector=app=nydus-snapshotter -n nydus-system -o=jsonpath='{.items[*].metadata.name}') - kubectl_retry logs "${pods_name}" -n nydus-system - kubectl_retry describe pod "${pods_name}" -n nydus-system + kubectl_retry logs --selector=app=nydus-snapshotter -n nydus-system + echo "::endgroup::" + echo "::group::nydus snapshotter describe" + kubectl_retry describe pod --selector=app=nydus-snapshotter -n nydus-system echo "::endgroup::" }