From 3ace7146ef50ca265e0514bcd387d5e120f607c0 Mon Sep 17 00:00:00 2001 From: "thomas.lee" Date: Wed, 4 Dec 2024 12:23:44 +0800 Subject: [PATCH] feat(pass-businessid): add unit test for multi-container having businessid as PodMetadata --- cronjob/tests/cronjob_test.yaml | 11 +- .../values/cronjob/argo_multi_container.yaml | 102 ++++++++++++++++++ 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 cronjob/tests/values/cronjob/argo_multi_container.yaml diff --git a/cronjob/tests/cronjob_test.yaml b/cronjob/tests/cronjob_test.yaml index 1831b73..6fb73d1 100644 --- a/cronjob/tests/cronjob_test.yaml +++ b/cronjob/tests/cronjob_test.yaml @@ -248,4 +248,13 @@ tests: businessid: ~ asserts: - failedTemplate: - errorMessage: businessid must be provided \ No newline at end of file + errorMessage: businessid must be provided + - it: should render an multi-container argo cron workflow + values: + - ./values/cronjob/argo_multi_container.yaml + asserts: + - hasDocuments: + count: 1 + - equal: + path: spec.workflowSpec.templates[1].metadata.labels.businessid + value: "some-business-id" diff --git a/cronjob/tests/values/cronjob/argo_multi_container.yaml b/cronjob/tests/values/cronjob/argo_multi_container.yaml new file mode 100644 index 0000000..e9fa286 --- /dev/null +++ b/cronjob/tests/values/cronjob/argo_multi_container.yaml @@ -0,0 +1,102 @@ +name: simple-cron-workflow +schedule: 1 * * * * +kind: CronWorkflow +businessid: "some-business-id" +startingDeadlineSeconds: {} +job: + retries: 1 + timeout: 1800 + retryPolicy: OnFailure +ttlStrategy: + secondsAfterCompletion: 600 +podGC: + strategy: OnPodCompletion +annotations: {} +image: + repository: test/testImage + tag: latest +command: + - bundle + - exec + - rails + - test +args: + - abc +resources: + requests: + cpu: 300m + memory: 2Gi +exitNotifications: + slackApp: + portalDomain: https://argo.com + webhookUrl: https://webhook/service/test + mention: + onFailure: + - U0123ABC123 + - S0345DEF345 + onSuccess: + - U0123ABC123 + - S0345DEF345 + newRelic: + image: + repository: test/test-newrelic-agent + tag: latest + licenseKey: 12345testtest1234test + appName: Test App + healthcheckIo: + uuid: arf21-323s-232d-23dasd +env: + RAILS_ENV: staging +envSecrets: + MONGODB_USER: mongodb +envFrom: + configMapRef: + - test-1-env + - test-2-env + secretRef: + - test-1-secret + - test-2-secret +serviceaccount: + annotations: + eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/my-service-account + name: my-service-account +pdb: + enable: true + minAvailable: 9999 +securityContextForPod: + runAsUser: 1000 + runAsGroup: 1000 + fsGroup: 1000 +nodeSelector: + nodegroup: ec-eks-db-cpu-node-autoscaling-group +tolerations: + - key: shop-callback-node + operator: Equal + value: "true" + effect: NoSchedule +dnsConfig: + options: + - name: ndots + value: "5" +affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: node.kubernetes.io/instance-type + operator: In + values: + - m6i.2xlarge + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: + a: 1 + topologyKey: topology.kubernetes.io/zone +containers: + - name: multi-step-test-container + image: + repository: test/testImage + tag: latest + args: + - echo "Hello, World!"