From 3500a9ca7389350c9a349a67c19572dc0e4139a0 Mon Sep 17 00:00:00 2001 From: saumil Macwan Date: Tue, 25 Jun 2024 11:44:58 -0400 Subject: [PATCH] fix: update test --- .../broker_deployment_test.yaml.snap | 140 ------------------ .../tests/broker_deployment_labels_test.yaml | 25 ++++ .../tests/broker_deployment_test.yaml | 11 +- 3 files changed, 26 insertions(+), 150 deletions(-) create mode 100644 charts/snyk-broker/tests/broker_deployment_labels_test.yaml diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap index 9701db7..ac8a586 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap @@ -569,146 +569,6 @@ default values: helm.sh/chart: snyk-broker-0.0.0 name: snyk-broker-RELEASE-NAME namespace: NAMESPACE -handles duplicative labels and adds new labels: - 1: | - apiVersion: apps/v1 - kind: Deployment - metadata: - labels: - app.kubernetes.io/instance: RELEASE-NAME - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-0.0.0 - test: node1 - name: github-com-broker-RELEASE-NAME - namespace: NAMESPACE - spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/instance: RELEASE-NAME - app.kubernetes.io/name: snyk-broker-RELEASE-NAME - template: - metadata: - labels: - app.kubernetes.io/instance: RELEASE-NAME - app.kubernetes.io/name: snyk-broker-RELEASE-NAME - spec: - containers: - - env: - - name: BROKER_SERVER_URL - value: https://broker.test.snyk.io - - name: BROKER_HEALTHCHECK_PATH - value: /healthcheck - - name: BROKER_SYSTEMCHECK_PATH - value: /systemcheck - - name: BROKER_TOKEN - valueFrom: - secretKeyRef: - key: github-com-broker-token-key - name: github-com-broker-token-RELEASE-NAME - - name: GITHUB_TOKEN - valueFrom: - secretKeyRef: - key: github-com-token-key - name: github-com-token-RELEASE-NAME - - name: PORT - value: "8000" - - name: BROKER_CLIENT_URL - value: http://brokerclient - - name: LOG_LEVEL - value: info - - name: LOG_ENABLE_BODY - value: "false" - - name: ACCEPT_CODE - value: "true" - - name: ACCEPT_IAC - value: tf,yaml,yml,json,tpl - - name: BROKER_DISPATCHER_BASE_URL - value: https://api.test.snyk.io - image: snyk/broker:github-com - imagePullPolicy: Always - livenessProbe: - failureThreshold: 3 - httpGet: - path: /healthcheck - port: 8000 - scheme: HTTP - initialDelaySeconds: 3 - periodSeconds: 10 - timeoutSeconds: 1 - name: github-com-broker-RELEASE-NAME - ports: - - containerPort: 8000 - name: http - readinessProbe: - failureThreshold: 3 - httpGet: - path: /healthcheck - port: 8000 - scheme: HTTP - initialDelaySeconds: 3 - periodSeconds: 10 - timeoutSeconds: 1 - resources: - limits: - cpu: 1 - memory: 256Mi - requests: - cpu: 1 - memory: 256Mi - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - readOnlyRootFilesystem: true - runAsNonRoot: true - runAsUser: 1000 - volumeMounts: null - securityContext: {} - serviceAccountName: snyk-broker-RELEASE-NAME - volumes: null - 2: | - apiVersion: v1 - kind: Service - metadata: - labels: - app.kubernetes.io/instance: RELEASE-NAME - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-0.0.0 - test: node1 - name: github-com-broker-service-RELEASE-NAME - namespace: NAMESPACE - spec: - ports: - - port: 8000 - targetPort: 8000 - selector: - app.kubernetes.io/instance: RELEASE-NAME - app.kubernetes.io/name: snyk-broker-RELEASE-NAME - type: ClusterIP - 3: | - apiVersion: v1 - data: - github-com-broker-token-key: MTIz - kind: Secret - metadata: - name: github-com-broker-token-RELEASE-NAME - type: Opaque - 4: | - apiVersion: v1 - kind: ServiceAccount - metadata: - labels: - app.kubernetes.io/instance: RELEASE-NAME - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-0.0.0 - test: node1 - name: snyk-broker-RELEASE-NAME - namespace: NAMESPACE preflight checks off: 1: | apiVersion: apps/v1 diff --git a/charts/snyk-broker/tests/broker_deployment_labels_test.yaml b/charts/snyk-broker/tests/broker_deployment_labels_test.yaml new file mode 100644 index 0000000..b839f3a --- /dev/null +++ b/charts/snyk-broker/tests/broker_deployment_labels_test.yaml @@ -0,0 +1,25 @@ +suite: test broker deployment +chart: + version: 0.0.0 +templates: + - broker_deployment.yaml + - broker_service.yaml + - serviceaccount.yaml + +tests: + - it: handles duplicative labels and adds new labels + values: + - ./fixtures/default_values.yaml + set: + labels: + app.kubernetes.io/name: "my duplicated label" + test: node1 + asserts: + - equal: + path: metadata.labels + value: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 + test: node1 \ No newline at end of file diff --git a/charts/snyk-broker/tests/broker_deployment_test.yaml b/charts/snyk-broker/tests/broker_deployment_test.yaml index 3fb0ccb..033cbee 100644 --- a/charts/snyk-broker/tests/broker_deployment_test.yaml +++ b/charts/snyk-broker/tests/broker_deployment_test.yaml @@ -32,13 +32,4 @@ tests: values: - ./fixtures/default_values_ha_on_4_replicas.yaml asserts: - - matchSnapshot: {} - - it: handles duplicative labels and adds new labels - values: - - ./fixtures/default_values.yaml - set: - labels: - app.kubernetes.io/name: "my duplicated label" - test: node1 - asserts: - - matchSnapshot: {} + - matchSnapshot: {} \ No newline at end of file