From 60d36d3fd1d4edd8ad4ed21bb0c9177f0cdec630 Mon Sep 17 00:00:00 2001 From: Siddhesh Ghadi Date: Thu, 28 Dec 2023 13:20:35 +0530 Subject: [PATCH] Update tests to verify repo server addr bug fix Signed-off-by: Siddhesh Ghadi --- .../01-assert.yaml | 2 +- .../01-install-argocd.yaml | 2 +- .../02-update-notifications-cm.yaml | 2 +- .../04-create-app.yaml | 2 +- .../05-verify-webhook-notification.yaml | 15 +++++++-------- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/k8s/1-034_validate_webhook_notifications/01-assert.yaml b/tests/k8s/1-034_validate_webhook_notifications/01-assert.yaml index 9caf46bc2..e5538b7bf 100644 --- a/tests/k8s/1-034_validate_webhook_notifications/01-assert.yaml +++ b/tests/k8s/1-034_validate_webhook_notifications/01-assert.yaml @@ -1,7 +1,7 @@ apiVersion: argoproj.io/v1alpha1 kind: ArgoCD metadata: - name: argocd + name: example status: phase: Available notificationsController: Running diff --git a/tests/k8s/1-034_validate_webhook_notifications/01-install-argocd.yaml b/tests/k8s/1-034_validate_webhook_notifications/01-install-argocd.yaml index fbf2dd794..b805ecf93 100644 --- a/tests/k8s/1-034_validate_webhook_notifications/01-install-argocd.yaml +++ b/tests/k8s/1-034_validate_webhook_notifications/01-install-argocd.yaml @@ -1,7 +1,7 @@ apiVersion: argoproj.io/v1alpha1 kind: ArgoCD metadata: - name: argocd + name: example spec: notifications: enabled: true diff --git a/tests/k8s/1-034_validate_webhook_notifications/02-update-notifications-cm.yaml b/tests/k8s/1-034_validate_webhook_notifications/02-update-notifications-cm.yaml index 39aea3253..4b70e6265 100644 --- a/tests/k8s/1-034_validate_webhook_notifications/02-update-notifications-cm.yaml +++ b/tests/k8s/1-034_validate_webhook_notifications/02-update-notifications-cm.yaml @@ -10,7 +10,7 @@ data: test-webhook: method: POST body: | - {"created":"{{.app.metadata.name}}"} + {"created":"{{.app.metadata.name}}","type":"{{(call .repo.GetAppDetails).Type}}"} trigger.test-on-created: |- - description: Application is created. send: ["test-app-created"] diff --git a/tests/k8s/1-034_validate_webhook_notifications/04-create-app.yaml b/tests/k8s/1-034_validate_webhook_notifications/04-create-app.yaml index 9ae4ff956..932c9da75 100644 --- a/tests/k8s/1-034_validate_webhook_notifications/04-create-app.yaml +++ b/tests/k8s/1-034_validate_webhook_notifications/04-create-app.yaml @@ -22,4 +22,4 @@ commands: path: test/examples/nginx targetRevision: HEAD EOF -- script: sleep 5 \ No newline at end of file +- script: sleep 10 \ No newline at end of file diff --git a/tests/k8s/1-034_validate_webhook_notifications/05-verify-webhook-notification.yaml b/tests/k8s/1-034_validate_webhook_notifications/05-verify-webhook-notification.yaml index ab1d9436d..d93806d64 100644 --- a/tests/k8s/1-034_validate_webhook_notifications/05-verify-webhook-notification.yaml +++ b/tests/k8s/1-034_validate_webhook_notifications/05-verify-webhook-notification.yaml @@ -4,7 +4,7 @@ commands: # verify no x509 in notifications-controller logs - script: | #!/bin/bash - kubectl -n $NAMESPACE logs deployment.apps/argocd-notifications-controller | grep "x509" + kubectl -n $NAMESPACE logs deployment.apps/example-notifications-controller | grep "x509" PREV_CMD=$? if [ $PREV_CMD -eq 1 ]; then @@ -15,11 +15,10 @@ commands: # verify notification delivery - script: | #!/bin/bash - kubectl -n $NAMESPACE logs deployment.apps/webhook | grep '{"created":"my-app-3"}' - PREV_CMD=$? - if [ $PREV_CMD -eq 0 ]; then - exit 0 - else - exit 1 - fi + # delays could occur in receiving notification, hence retry before failing + for i in {1..5} + do + sleep 5 + kubectl -n $NAMESPACE logs deployment.apps/webhook | grep '{"created":"my-app-3","type":"Directory"}' && break + done \ No newline at end of file