Skip to content

Commit

Permalink
Fix failed e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Cai <yicai@redhat.com>
  • Loading branch information
ciiay committed Jun 20, 2023
1 parent 0602da7 commit 1e74381
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 42 deletions.
4 changes: 0 additions & 4 deletions tests/ha/1-020_validate_redis_ha_nonha/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 720
---
apiVersion: v1
kind: Service
metadata:
Expand Down
4 changes: 0 additions & 4 deletions tests/ha/1-020_validate_redis_ha_nonha/04-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 720
---
apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: sleep 30
- script: |
set -e
expected=10
wlCommand=$(kubectl get -n $NAMESPACE statefulset/argocd-application-controller -o jsonpath='{.spec.template.spec.containers[0].command}'| jq -r '.[]' )
if ! echo "$wlCommand" | grep -qPz -- "--kubectl-parallelism-limit\\n${expected}(\$|\\n)"; then
expected="10"
wlCommand=$(kubectl get -n $NAMESPACE statefulset/argocd-application-controller -o jsonpath='{.spec.template.spec.containers[0].command}'| jq -r '.[]')
if ! echo "$wlCommand" | grep -Fxq -- "--kubectl-parallelism-limit"; then
echo "Incorrect or missing --kubectl-parallelism-limit detected."
echo "$wlCommand"
exit 1
fi
if ! echo "$wlCommand" | grep -Fxq -- "$expected"; then
echo "Incorrect value for --kubectl-parallelism-limit detected."
echo "$wlCommand"
exit 1
fi
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: sleep 30
- script: |
set -e
expected=20
wlCommand=$(kubectl get -n $NAMESPACE statefulset/argocd-application-controller -o jsonpath='{.spec.template.spec.containers[0].command}'| jq -r '.[]' )
if ! echo "$wlCommand" | grep -qPz -- "--kubectl-parallelism-limit\\n${expected}(\$|\\n)"; then
expected="20"
wlCommand=$(kubectl get -n $NAMESPACE statefulset/argocd-application-controller -o jsonpath='{.spec.template.spec.containers[0].command}'| jq -r '.[]')
if ! echo "$wlCommand" | grep -Fxq -- "--kubectl-parallelism-limit"; then
echo "Incorrect or missing --kubectl-parallelism-limit detected."
echo "$wlCommand"
exit 1
fi
if ! echo "$wlCommand" | grep -Fxq -- "$expected"; then
echo "Incorrect value for --kubectl-parallelism-limit detected."
echo "$wlCommand"
exit 1
fi
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
set -e
wait:
- condition: command-exit-code
timeout: 30s
command: |
kubectl patch -n $NAMESPACE argocds/argocd --type=json --patch '[{"op": "remove", "path": "/spec/controller/parallelismLimit"}]'
- script: sleep 30
successCodes: [0]
- script: |
set -e
expected=10
wlCommand=$(kubectl get -n $NAMESPACE statefulset/argocd-application-controller -o jsonpath='{.spec.template.spec.containers[0].command}'| jq -r '.[]' )
if ! echo "$wlCommand" | grep -qPz -- "--kubectl-parallelism-limit\\n${expected}(\$|\\n)"; then
expected="10"
wlCommand=$(kubectl get -n $NAMESPACE statefulset/argocd-application-controller -o jsonpath='{.spec.template.spec.containers[0].command}'| jq -r '.[]')
if ! echo "$wlCommand" | grep -Fxq -- "--kubectl-parallelism-limit"; then
echo "Incorrect or missing --kubectl-parallelism-limit detected."
echo "$wlCommand"
exit 1
fi
fi
if ! echo "$wlCommand" | grep -Fxq -- "$expected"; then
echo "Incorrect value for --kubectl-parallelism-limit detected."
echo "$wlCommand"
exit 1
fi
15 changes: 3 additions & 12 deletions tests/k8s/1-022_validate_notifications/05-verify-email.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@ apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
set -e
smtp4dev_pod=$(kubectl get pod -l=app=smtp4dev -o NAME -n $NAMESPACE)
exit_code=$(kubectl -n $NAMESPACE exec -i --stdin "${smtp4dev_pod}" -- /bin/bash \
-c 'if [[ $(grep -rnw /tmp -e "Subject: Application my-app-3 has been created.") ]]; then
exit 0; else
exit 1;
fi')
set -euo pipefail
if [ $exit_code=0 ]; then
exit 0
else
exit 1
fi
smtp4dev_pod=$(kubectl get pod -l=app=smtp4dev -o jsonpath='{.items[0].metadata.name}' -n $NAMESPACE)
kubectl -n $NAMESPACE exec -i "${smtp4dev_pod}" -- /bin/bash -c 'grep -rnw /tmp -e "Subject: Application my-app-3 has been created."'
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
name: example-argocd
namespace: central-argocd
commands:
# Sleep to allow resources to be completely deleted
- command: sleep 30s
wait:
- condition: delete
timeout: 30s
selector:
apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
name: example-argocd
namespace: central-argocd
2 changes: 0 additions & 2 deletions tests/k8s/1-024_validate_apps_in_any_namespace/99-delete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ delete:
- apiVersion: v1
kind: Namespace
name: central-argocd
commands:
- command: sleep 30s
14 changes: 14 additions & 0 deletions tests/k8s/1-024_validate_apps_in_any_namespace/99-errors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Namespace
metadata:
name: test-1-24-custom
---
apiVersion: v1
kind: Namespace
metadata:
name: test-2-24-custom
---
apiVersion: v1
kind: Namespace
metadata:
name: central-argocd

0 comments on commit 1e74381

Please sign in to comment.