Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chart: incrementals-publisher unit tests for secrets #1077

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/incrementals-publisher/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
description: incrementals-publisher
name: incrementals-publisher
version: 0.7.0
version: 0.8.0
sarathchandra24 marked this conversation as resolved.
Show resolved Hide resolved
46 changes: 43 additions & 3 deletions charts/incrementals-publisher/tests/custom_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ suite: Custom values
templates:
- deployment.yaml
- secret.yaml # dependency of deployment.yaml
values:
# These values are required by the template "secret.yaml"
- secret-values.yaml
set:
permissions_url: https://somewhere.jenkins.io/github.json
artifactory:
key: testingArtifactoryKey
github:
token: customSuperSecretToken
appId: customSuperSecretAppId
privateKey: customSuperSecretPrivateKey
jenkins:
auth: customSecretJenkinsUser:customSecretJenkinsPassword
preshared_key: customSuperSecretPreSharedKey
sarathchandra24 marked this conversation as resolved.
Show resolved Hide resolved
tests:
- it: should define a deployment with the provided custom settings
template: deployment.yaml
Expand All @@ -33,3 +39,37 @@ tests:
name: PERMISSIONS_URL
value: https://somewhere.jenkins.io/github.json
any: true
- contains:
path: spec.template.spec.containers[0].env
content:
name: JENKINS_AUTH
valueFrom:
secretKeyRef:
key: jenkins_auth
name: RELEASE-NAME-incrementals-publisher

- it: should define a secret with the provided custom settings
template: secret.yaml
asserts:
- hasDocuments:
count: 1
- isKind:
of: Secret
- equal:
path: data.artifactory_key
value: dGVzdGluZ0FydGlmYWN0b3J5S2V5
- equal:
path: data.github_token
value: Y3VzdG9tU3VwZXJTZWNyZXRUb2tlbg==
- equal:
path: data.github_app_id
value: Y3VzdG9tU3VwZXJTZWNyZXRBcHBJZA==
- equal:
path: data.github_app_private_key
value: Y3VzdG9tU3VwZXJTZWNyZXRQcml2YXRlS2V5
- equal:
path: data.jenkins_auth
value: Y3VzdG9tU2VjcmV0SmVua2luc1VzZXI6Y3VzdG9tU2VjcmV0SmVua2luc1Bhc3N3b3Jk
- equal:
path: data.preshared_key
value: Y3VzdG9tU3VwZXJTZWNyZXRQcmVTaGFyZWRLZXk=
68 changes: 68 additions & 0 deletions charts/incrementals-publisher/tests/defaults_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,71 @@ tests:
content:
name: PERMISSIONS_URL
any: true
- contains:
path: spec.template.spec.containers[0].env
content:
name: JENKINS_AUTH
valueFrom:
secretKeyRef:
key: jenkins_auth
name: RELEASE-NAME-incrementals-publisher
- contains:
path: spec.template.spec.containers[0].env
content:
name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
key: github_token
name: RELEASE-NAME-incrementals-publisher
- contains:
path: spec.template.spec.containers[0].env
content:
name: GITHUB_APP_ID
valueFrom:
secretKeyRef:
key: github_app_id
name: RELEASE-NAME-incrementals-publisher
any: true
- contains:
path: spec.template.spec.containers[0].env
content:
name: GITHUB_APP_PRIVATE_KEY
valueFrom:
secretKeyRef:
key: github_app_private_key
name: RELEASE-NAME-incrementals-publisher
any: true
- contains:
path: spec.template.spec.containers[0].env
content:
name: ARTIFACTORY_KEY
valueFrom:
secretKeyRef:
key: artifactory_key
name: RELEASE-NAME-incrementals-publisher
any: true
- it: should define a secret with the provided custom settings
template: secret.yaml
asserts:
- hasDocuments:
count: 1
- isKind:
of: Secret
- equal:
path: data.artifactory_key
value: c3VwZXJTZWNyZXRLZXk=
- equal:
path: data.github_token
value: c3VwZXJTZWNyZXRUb2tlbg==
- equal:
path: data.github_app_id
value: c3VwZXJTZWNyZXRJRA==
- equal:
path: data.github_app_private_key
value: c3VwZXJTZWNyZXRLZXk=
- equal:
path: data.jenkins_auth
value: c2VjcmV0SmVua2luc1VzZXI6c3VwZXJTZWNyZXRKZW5raW5zVXNlclBhc3M=
- equal:
path: data.preshared_key
value: c3VwZXJTZWNyZXRQcmVTaGFyZWRLZXk=
10 changes: 6 additions & 4 deletions charts/incrementals-publisher/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ affinity: {}
permissions_url: ''
artifactory:
# artifactory.key -- key to upload to artifactory
key: ''
key: 'testingArtifactoryKey'
github:
# github.token -- token to update github checks and look up commits
token: ''
token: 'customSuperSecretToken'
appId: 'customSuperSecretAppId'
privateKey: 'customSuperSecretPrivateKey'
jenkins:
# jenkins.auth -- username:accesskey to talk to jenkins apis to pull build metadata
auth: ''
auth: 'customSecretJenkinsUser:customSecretJenkinsPassword'
# preshared_key -- The token needed to be provided for autherization
preshared_key: ''
preshared_key: 'customSuperSecretPreSharedKey'
Loading