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.
This commit is contained in:
Arda Güçlü 2023-02-07 14:19:34 +03:00
parent 8e20effbb7
commit 60401d35d1

View File

@ -78,6 +78,9 @@ spec:
command: ["/bin/sh", "-c", "sleep infinity"] command: ["/bin/sh", "-c", "sleep infinity"]
EOF EOF
# Make sure deployment is successfully applied
kube::test::wait_object_assert deployments "{{range.items}}{{${id_field:?}}}{{end}}" 'dtest'
set +o errexit set +o errexit
# wait timeout error because condition is invalid # wait timeout error because condition is invalid
start_sec=$(date +"%s") start_sec=$(date +"%s")