Skip to content

Commit e52e7d5

Browse files
committed
Fix intermittent failures of E2E tests 1-045 and 1-069
Signed-off-by: Jonathan West <[email protected]>
1 parent 9b14ac4 commit e52e7d5

File tree

2 files changed

+58
-20
lines changed

2 files changed

+58
-20
lines changed

test/openshift/e2e/parallel/1-045_validate_repo_exec_timeout/04-check-workload-env.yaml

+25-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
apiVersion: kuttl.dev/v1beta1
22
kind: TestStep
33
commands:
4-
- script: sleep 10
5-
- script: |
6-
timeout=$(oc get -n $NAMESPACE deployment argocd-repo-server -o json \
7-
| jq -r '.spec.template.spec.containers[0].env[]|select(.name=="ARGOCD_EXEC_TIMEOUT").value')
8-
if test "$timeout" != "300s"; then
9-
echo "Assertion failed. Timeout should be 300s, is '$timeout'"
4+
- script: |
5+
function check_timeout() {
6+
timeout=$(oc get -n $NAMESPACE deployment argocd-repo-server -o json \
7+
| jq -r '.spec.template.spec.containers[0].env[]|select(.name=="ARGOCD_EXEC_TIMEOUT").value')
8+
if test "$timeout" != "300s"; then
9+
echo "Waiting for timeout to be 300s, is '$timeout'"
10+
return 1
11+
fi
12+
return 0
13+
}
14+
15+
echo -n "Waiting until timeout has expected value"
16+
for i in {1..150}; do # timeout after 5 minutes
17+
18+
if check_timeout; then
19+
# success
20+
echo ".spec.template.spec.containers[0].env had expected env var"
21+
exit 0
22+
else
23+
echo "Still waiting for 'spec.template.spec.containers[0].env' to have expected env var"
24+
fi
25+
sleep 2
26+
done
27+
28+
echo ".spec.template.spec.containers[0].env never had expected env var"
1029
exit 1
11-
fi

test/openshift/e2e/parallel/1-069_validate_redis_secure_comm_autotls_ha/03-check_secret.yaml

+33-13
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,37 @@ apiVersion: kuttl.dev/v1beta1
22
kind: TestStep
33
commands:
44
- script: |
5-
set -e
6-
secret_type="$(oc get secrets argocd-operator-redis-tls -n $NAMESPACE --template '{{.type}}')"
7-
secret_len="$(oc get secrets argocd-operator-redis-tls -n $NAMESPACE --template '{{len .data}}')"
8-
expected_secret_type="kubernetes.io/tls"
9-
expected_secret_len=2
5+
function check_secret() {
6+
secret_type="$(oc get secrets argocd-operator-redis-tls -n $NAMESPACE --template '{{.type}}')"
7+
secret_len="$(oc get secrets argocd-operator-redis-tls -n $NAMESPACE --template '{{len .data}}')"
8+
expected_secret_type="kubernetes.io/tls"
9+
expected_secret_len=2
1010
11-
if test ${secret_type} != ${expected_secret_type}; then
12-
echo "argocd-operator-redis-tls secret type is ${secret_type} and should be ${expected_secret_type}"
13-
exit 1
14-
fi
15-
if test ${secret_len} != ${expected_secret_len}; then
16-
echo "argocd-operator-redis-tls secret length is ${secret_len} and should be ${expected_secret_len}"
17-
exit 1
18-
fi
11+
if test ${secret_type} != ${expected_secret_type}; then
12+
echo "argocd-operator-redis-tls secret type is ${secret_type} and should be ${expected_secret_type}"
13+
return 1
14+
fi
15+
if test ${secret_len} != ${expected_secret_len}; then
16+
echo "argocd-operator-redis-tls secret length is ${secret_len} and should be ${expected_secret_len}"
17+
return 1
18+
fi
19+
20+
return 0
21+
}
22+
23+
echo -n "Waiting until secret has expected type and .data length"
24+
for i in {1..150}; do # timeout after 5 minutes
25+
26+
if check_secret; then
27+
# success
28+
echo "Secret has expected length and type."
29+
exit 0
30+
else
31+
echo "Still waiting for Secret to have expected length and type."
32+
fi
33+
sleep 2
34+
done
35+
36+
echo "Secret never had expected length and type"
37+
exit 1
38+

0 commit comments

Comments
 (0)