Skip to content

Commit

Permalink
Fix intermittent failures of E2E tests 1-045 and 1-069
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan West <jonwest@redhat.com>
  • Loading branch information
jgwest committed Jan 16, 2025
1 parent f652316 commit 84be9f6
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: sleep 10
- script: |
timeout=$(oc get -n $NAMESPACE deployment argocd-repo-server -o json \
| jq -r '.spec.template.spec.containers[0].env[]|select(.name=="ARGOCD_EXEC_TIMEOUT").value')
if test "$timeout" != "300s"; then
echo "Assertion failed. Timeout should be 300s, is '$timeout'"
- script:
func check_timeout() {
timeout=$(oc get -n $NAMESPACE deployment argocd-repo-server -o json \
| jq -r '.spec.template.spec.containers[0].env[]|select(.name=="ARGOCD_EXEC_TIMEOUT").value')
if test "$timeout" != "300s"; then
echo "Waiting for timeout to be 300s, is '$timeout'"
return 1
fi
return 0
}

echo -n "Waiting until timeout has expected value"
for i in {1..150}; do # timeout after 5 minutes

if check_timeout; then
# success
echo ".spec.template.spec.containers[0].env had expected env var"
exit 0
else
echo "Still waiting for 'spec.template.spec.containers[0].env' to have expected env var"
fi
sleep 2
done

echo ".spec.template.spec.containers[0].env never had expected env var"
exit 1
fi
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,38 @@ apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
set -e
secret_type="$(oc get secrets argocd-operator-redis-tls -n $NAMESPACE --template '{{.type}}')"
secret_len="$(oc get secrets argocd-operator-redis-tls -n $NAMESPACE --template '{{len .data}}')"
expected_secret_type="kubernetes.io/tls"
expected_secret_len=2
func check_secret() {
secret_type="$(oc get secrets argocd-operator-redis-tls -n $NAMESPACE --template '{{.type}}')"
secret_len="$(oc get secrets argocd-operator-redis-tls -n $NAMESPACE --template '{{len .data}}')"
expected_secret_type="kubernetes.io/tls"
expected_secret_len=2
if test ${secret_type} != ${expected_secret_type}; then
echo "argocd-operator-redis-tls secret type is ${secret_type} and should be ${expected_secret_type}"
exit 1
fi
if test ${secret_len} != ${expected_secret_len}; then
echo "argocd-operator-redis-tls secret length is ${secret_len} and should be ${expected_secret_len}"
exit 1
fi
if test ${secret_type} != ${expected_secret_type}; then
echo "argocd-operator-redis-tls secret type is ${secret_type} and should be ${expected_secret_type}"
return 1
fi
if test ${secret_len} != ${expected_secret_len}; then
echo "argocd-operator-redis-tls secret length is ${secret_len} and should be ${expected_secret_len}"
return 1
fi
return 0
}
echo -n "Waiting until secret has expected type and .data length"
for i in {1..150}; do # timeout after 5 minutes
if check_secret; then
# success
echo "Secret has expected length and type."
exit 0
else
echo "Still waiting for Secret to have expected length and type."
fi
sleep 2
done
echo "Secret never had expected length and type"
exit 1

0 comments on commit 84be9f6

Please sign in to comment.