Skip to content

Commit

Permalink
fix: add unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
soniqua committed Apr 15, 2024
1 parent 5b05e0e commit d0dc981
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
renders extraPodSpecs CRA:
1: |
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: container-registry-agent-broker-token-key
name: container-registry-agent-broker-token-RELEASE-NAME
- name: CR_AGENT_URL
value: http://cra-service-RELEASE-NAME:8081
- name: CR_TYPE
value: ecr
- name: CR_ROLE_ARN
value: arn:aws-us-gov:iam::123456789012:role
- name: CR_REGION
value: eu-west
- name: CR_EXTERNAL_ID
value: 11111111-1111-1111-1111-111111111111
- name: PORT
value: "8000"
- name: BROKER_CLIENT_URL
value: http://container-registry-agent-broker-service-RELEASE-NAME:8000
- name: BROKER_CLIENT_VALIDATION_URL
value: http://cra-service-RELEASE-NAME:8081/healthcheck
- name: LOG_LEVEL
value: info
- name: LOG_ENABLE_BODY
value: "false"
- name: BROKER_DISPATCHER_BASE_URL
value: https://api.test.snyk.io
image: snyk/broker:container-registry-agent
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthcheck
port: 8000
scheme: HTTP
initialDelaySeconds: 3
periodSeconds: 10
timeoutSeconds: 1
name: container-registry-agent-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
nodeSelector:
corp.io/node-classification: snyk
securityContext: {}
serviceAccountName: snyk-broker-RELEASE-NAME
tolerations:
- effect: NoSchedule
key: networking/something
operator: Equal
value: internal-pods
volumes: null
2: |
containers:
- env:
- name: SNYK_PORT
value: "8081"
image: snyk/container-registry-agent:latest
imagePullPolicy: Always
name: container-registry-agent-RELEASE-NAME
ports:
- containerPort: 8081
name: http
resources:
limits:
cpu: 1
memory: 2Gi
requests:
cpu: 1
memory: 2Gi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 1000
nodeSelector:
corp.io/node-classification: snyk
securityContext: {}
serviceAccountName: snyk-broker-RELEASE-NAME
tolerations:
- effect: NoSchedule
key: networking/something
operator: Equal
value: internal-pods
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
suite: test broker deployment with extraPodSpec
chart:
version: 0.0.0
templates:
- broker_deployment.yaml
- cra_deployment.yaml
values:
- ./fixtures/default_values_cra.yaml
- ./fixtures/extra_pod_spec_values.yaml

tests:
- it: renders extraPodSpecs CRA
asserts:
- matchSnapshot:
path: spec.template.spec
template: broker_deployment.yaml
- matchSnapshot:
path: spec.template.spec
template: cra_deployment.yaml
documentIndex: 0
18 changes: 18 additions & 0 deletions charts/snyk-broker/tests/fixtures/extra_pod_spec_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

extraPodSpecs:
tolerations:
- key: "networking/something"
operator: "Equal"
value: "internal-pods"
effect: "NoSchedule"
nodeSelector:
corp.io/node-classification: snyk

extraPodSpecsCr:
tolerations:
- key: "networking/something"
operator: "Equal"
value: "internal-pods"
effect: "NoSchedule"
nodeSelector:
corp.io/node-classification: snyk

0 comments on commit d0dc981

Please sign in to comment.