From 60401d35d1dcdf4814674ff3fd96b70c312700d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arda=20G=C3=BC=C3=A7l=C3=BC?= Date: Tue, 7 Feb 2023 14:19:34 +0300 Subject: [PATCH] flaky test wait.sh: Add deployment assertion before running wait There is a test in wait.sh integration suite which is checking the given timeout value(passed by user) is equal to actual happened timeout value. However, this test rarely gets `no matching resources found` error and causes flakyiness. The reason is we are running wait command, immediately after applying deployment. In reality, timeout test does not care about deployment, since it is testing the timeout by passing invalid configurations. But we need this deployment to not get `no matching resources found` error. That's why, this PR adds deployment assertion before executing wait command. --- test/cmd/wait.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/cmd/wait.sh b/test/cmd/wait.sh index 3a3cd990fe5..242ae435ea2 100644 --- a/test/cmd/wait.sh +++ b/test/cmd/wait.sh @@ -78,6 +78,9 @@ spec: command: ["/bin/sh", "-c", "sleep infinity"] EOF + # Make sure deployment is successfully applied + kube::test::wait_object_assert deployments "{{range.items}}{{${id_field:?}}}{{end}}" 'dtest' + set +o errexit # wait timeout error because condition is invalid start_sec=$(date +"%s")