diff --git a/tests/ha/1-020_validate_redis_ha_nonha/01-assert.yaml b/tests/ha/1-020_validate_redis_ha_nonha/01-assert.yaml index 77e2f772f..3fdf539dc 100644 --- a/tests/ha/1-020_validate_redis_ha_nonha/01-assert.yaml +++ b/tests/ha/1-020_validate_redis_ha_nonha/01-assert.yaml @@ -1,7 +1,3 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -timeout: 720 ---- apiVersion: v1 kind: Service metadata: diff --git a/tests/ha/1-020_validate_redis_ha_nonha/04-assert.yaml b/tests/ha/1-020_validate_redis_ha_nonha/04-assert.yaml index 2d48ff872..c48877c14 100644 --- a/tests/ha/1-020_validate_redis_ha_nonha/04-assert.yaml +++ b/tests/ha/1-020_validate_redis_ha_nonha/04-assert.yaml @@ -1,7 +1,3 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -timeout: 720 ---- apiVersion: argoproj.io/v1alpha1 kind: ArgoCD metadata: diff --git a/tests/k8s/1-014_validate_parallelism_limit/02-check-deployment.yaml b/tests/k8s/1-014_validate_parallelism_limit/02-check-deployment.yaml index b60954eb0..d2b23a0bb 100644 --- a/tests/k8s/1-014_validate_parallelism_limit/02-check-deployment.yaml +++ b/tests/k8s/1-014_validate_parallelism_limit/02-check-deployment.yaml @@ -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 \ No newline at end of file diff --git a/tests/k8s/1-014_validate_parallelism_limit/04-check-deployment.yaml b/tests/k8s/1-014_validate_parallelism_limit/04-check-deployment.yaml index edbdbe5eb..8c710be9b 100644 --- a/tests/k8s/1-014_validate_parallelism_limit/04-check-deployment.yaml +++ b/tests/k8s/1-014_validate_parallelism_limit/04-check-deployment.yaml @@ -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 \ No newline at end of file diff --git a/tests/k8s/1-014_validate_parallelism_limit/06-check-deployment.yaml b/tests/k8s/1-014_validate_parallelism_limit/06-check-deployment.yaml index 753984460..f5eed3237 100644 --- a/tests/k8s/1-014_validate_parallelism_limit/06-check-deployment.yaml +++ b/tests/k8s/1-014_validate_parallelism_limit/06-check-deployment.yaml @@ -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 \ No newline at end of file + fi + if ! echo "$wlCommand" | grep -Fxq -- "$expected"; then + echo "Incorrect value for --kubectl-parallelism-limit detected." + echo "$wlCommand" + exit 1 + fi diff --git a/tests/k8s/1-022_validate_notifications/05-verify-email.yaml b/tests/k8s/1-022_validate_notifications/05-verify-email.yaml index 239621b07..97f5c7381 100644 --- a/tests/k8s/1-022_validate_notifications/05-verify-email.yaml +++ b/tests/k8s/1-022_validate_notifications/05-verify-email.yaml @@ -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 \ No newline at end of file + 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."' diff --git a/tests/k8s/1-024_validate_apps_in_any_namespace/03-delete-argocd.yaml b/tests/k8s/1-024_validate_apps_in_any_namespace/03-delete-argocd.yaml index 8f02301dc..fe41808c5 100644 --- a/tests/k8s/1-024_validate_apps_in_any_namespace/03-delete-argocd.yaml +++ b/tests/k8s/1-024_validate_apps_in_any_namespace/03-delete-argocd.yaml @@ -1,4 +1,3 @@ ---- apiVersion: kuttl.dev/v1beta1 kind: TestStep delete: @@ -6,6 +5,11 @@ delete: kind: ArgoCD name: example-argocd namespace: central-argocd -commands: - # Sleep to allow resources to be completely deleted - - command: sleep 30s \ No newline at end of file +wait: +- condition: delete + timeout: 30s + selector: + apiVersion: argoproj.io/v1alpha1 + kind: ArgoCD + name: example-argocd + namespace: central-argocd diff --git a/tests/k8s/1-024_validate_apps_in_any_namespace/99-delete.yaml b/tests/k8s/1-024_validate_apps_in_any_namespace/99-delete.yaml index 0d87c9379..b0dd05839 100644 --- a/tests/k8s/1-024_validate_apps_in_any_namespace/99-delete.yaml +++ b/tests/k8s/1-024_validate_apps_in_any_namespace/99-delete.yaml @@ -11,5 +11,3 @@ delete: - apiVersion: v1 kind: Namespace name: central-argocd -commands: - - command: sleep 30s \ No newline at end of file diff --git a/tests/k8s/1-024_validate_apps_in_any_namespace/99-errors.yaml b/tests/k8s/1-024_validate_apps_in_any_namespace/99-errors.yaml new file mode 100644 index 000000000..05de49f4c --- /dev/null +++ b/tests/k8s/1-024_validate_apps_in_any_namespace/99-errors.yaml @@ -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 \ No newline at end of file