-
Notifications
You must be signed in to change notification settings - Fork 190
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
Feat helm unittest #334
Feat helm unittest #334
Changes from all commits
f9f4483
450d138
8c0d7a0
4e3411a
56b604f
cfda86c
adb922f
3d04126
440b60c
33a626d
5494df7
baede95
e1044e2
25026cf
68288f6
3b216bc
f400585
6760b3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# IDE or Editor-specific | ||
.idea/ | ||
.vscode/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
suite: test secret-api for api secret | ||
templates: | ||
- secret-api.yaml | ||
release: | ||
name: my-release | ||
tests: | ||
- it: default values | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: apiSecretName | ||
set: | ||
apiSecretName: 'atlantis-api' | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: apiSecret | ||
set: | ||
api.secret: 'spongebob' | ||
commonLabels: | ||
team: "infra" | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: Secret | ||
- isAPIVersion: | ||
of: v1 | ||
- equal: | ||
path: metadata.name | ||
value: my-release-atlantis-api | ||
- equal: | ||
path: data["apisecret"] | ||
value: c3BvbmdlYm9i | ||
- equal: | ||
path: metadata.labels.team | ||
value: infra |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,52 @@ | ||||||
--- | ||||||
suite: test secret-aws for aws | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mind also adding a github action for this? # .github/workflows/tests.yaml
name: tests
on: pull_request
jobs:
unittest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: d3adb5/helm-unittest-action@v2
with:
# https://github.com/helm/helm/releases
helm-version: v3.13.2
github-token: ${{ secrets.GITHUB_TOKEN }} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this job is added, then it needs to be removed from Lines 7 to 8 in f400585
|
||||||
templates: | ||||||
- secret-aws.yaml | ||||||
release: | ||||||
name: my-release | ||||||
tests: | ||||||
- it: default values | ||||||
asserts: | ||||||
- hasDocuments: | ||||||
count: 0 | ||||||
- it: awsSecretName | ||||||
set: | ||||||
awsSecretName: 'atlantis-aws' | ||||||
asserts: | ||||||
- hasDocuments: | ||||||
count: 0 | ||||||
- it: aws | ||||||
set: | ||||||
aws: | ||||||
credentials: | | ||||||
[default] | ||||||
aws_access_key_id=YOUR_ACCESS_KEY_ID | ||||||
aws_secret_access_key=YOUR_SECRET_ACCESS_KEY | ||||||
region=us-east-1 | ||||||
config: | | ||||||
[profile a_role_to_assume] | ||||||
role_arn = arn:aws:iam::123456789:role/service-role/roleToAssume | ||||||
source_profile = default | ||||||
commonLabels: | ||||||
team: "infra" | ||||||
asserts: | ||||||
- hasDocuments: | ||||||
count: 1 | ||||||
- isKind: | ||||||
of: Secret | ||||||
- isAPIVersion: | ||||||
of: v1 | ||||||
- equal: | ||||||
path: metadata.name | ||||||
value: my-release-atlantis-aws | ||||||
- equal: | ||||||
path: data["config"] | ||||||
value: W3Byb2ZpbGUgYV9yb2xlX3RvX2Fzc3VtZV0Kcm9sZV9hcm4gPSBhcm46YXdzOmlhbTo6MTIzNDU2Nzg5OnJvbGUvc2VydmljZS1yb2xlL3JvbGVUb0Fzc3VtZQpzb3VyY2VfcHJvZmlsZSA9IGRlZmF1bHQK | ||||||
- equal: | ||||||
path: data["credentials"] | ||||||
value: W2RlZmF1bHRdCmF3c19hY2Nlc3Nfa2V5X2lkPVlPVVJfQUNDRVNTX0tFWV9JRAphd3Nfc2VjcmV0X2FjY2Vzc19rZXk9WU9VUl9TRUNSRVRfQUNDRVNTX0tFWQpyZWdpb249dXMtZWFzdC0xCg== | ||||||
- equal: | ||||||
path: metadata.labels.team | ||||||
value: infra | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
suite: test secret-basic-auth for git basic-auth secret | ||
templates: | ||
- secret-basic-auth.yaml | ||
release: | ||
name: my-release | ||
tests: | ||
- it: default values | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: basicAuthSecretName | ||
set: | ||
basicAuthSecretName: "atlantis-basic-auth" | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: basicAuth | ||
set: | ||
basicAuth: | ||
username: "atlantis" | ||
password: "forever" | ||
commonLabels: | ||
team: "infra" | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: Secret | ||
- isAPIVersion: | ||
of: v1 | ||
- equal: | ||
path: metadata.name | ||
value: my-release-atlantis-basic-auth | ||
- equal: | ||
path: data["username"] | ||
value: YXRsYW50aXM= | ||
- equal: | ||
path: data["password"] | ||
value: Zm9yZXZlcg== | ||
- equal: | ||
path: metadata.labels.team | ||
value: infra | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
suite: test secret-gitconfig for gitconfig | ||
templates: | ||
- secret-gitconfig.yaml | ||
release: | ||
name: my-release | ||
tests: | ||
- it: default values | ||
template: secret-gitconfig.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: gitconfigSecretName | ||
template: secret-gitconfig.yaml | ||
set: | ||
gitconfigSecretName: 'atlantis-gitconfig' | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: gitconfig | ||
template: secret-gitconfig.yaml | ||
set: | ||
gitconfig: | | ||
[url "https://[email protected]"] | ||
insteadOf = https://github.com | ||
commonLabels: | ||
team: "infra" | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: Secret | ||
- isAPIVersion: | ||
of: v1 | ||
- equal: | ||
path: metadata.name | ||
value: my-release-atlantis-gitconfig | ||
- equal: | ||
path: data["gitconfig"] | ||
value: W3VybCAiaHR0cHM6Ly9ZT1VSX0dIX1RPS0VOQGdpdGh1Yi5jb20iXQppbnN0ZWFkT2YgPSBodHRwczovL2dpdGh1Yi5jb20K | ||
- equal: | ||
path: metadata.labels.team | ||
value: infra | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
suite: test secret-netrc for netrc | ||
templates: | ||
- secret-netrc.yaml | ||
release: | ||
name: my-release | ||
tests: | ||
- it: default values | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: netrcSecretName | ||
set: | ||
netrcSecretName: 'atlantis-netrc' | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: netrc | ||
set: | ||
netrc: | | ||
machine artifactory.myapp.com login YOUR_USERNAME password YOUR_PASSWORD | ||
machine bitbucket.myapp.com login YOUR_USERNAME password YOUR_PASSWORD | ||
commonLabels: | ||
team: "infra" | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: Secret | ||
- isAPIVersion: | ||
of: v1 | ||
- equal: | ||
path: metadata.name | ||
value: my-release-atlantis-netrc | ||
- equal: | ||
path: data["netrc"] | ||
value: bWFjaGluZSBhcnRpZmFjdG9yeS5teWFwcC5jb20gbG9naW4gWU9VUl9VU0VSTkFNRSBwYXNzd29yZCBZT1VSX1BBU1NXT1JECm1hY2hpbmUgYml0YnVja2V0Lm15YXBwLmNvbSBsb2dpbiBZT1VSX1VTRVJOQU1FIHBhc3N3b3JkIFlPVVJfUEFTU1dPUkQK | ||
- equal: | ||
path: metadata.labels.team | ||
value: infra | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
suite: test secret-service-account for serviceAccountSecrets | ||
templates: | ||
- secret-service-account.yaml | ||
release: | ||
name: my-release | ||
tests: | ||
- it: default values | ||
template: secret-service-account.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: serviceAccountSecrets | ||
template: secret-service-account.yaml | ||
set: | ||
serviceAccountSecrets: | ||
credentials: VG9ueSBTb3ByYW5v | ||
credentials-staging: Q2FybWVsYSBTb3ByYW5v | ||
commonLabels: | ||
team: infra | ||
asserts: | ||
- hasDocuments: | ||
count: 2 | ||
- isKind: | ||
of: Secret | ||
- isAPIVersion: | ||
of: v1 | ||
- equal: | ||
path: metadata.labels.component | ||
value: service-account-secret | ||
- documentIndex: 0 | ||
equal: | ||
path: data["service-account.json"] | ||
value: VG9ueSBTb3ByYW5v | ||
- documentIndex: 0 | ||
equal: | ||
path: metadata.name | ||
value: credentials | ||
- documentIndex: 0 | ||
equal: | ||
path: metadata.labels.team | ||
value: infra | ||
- documentIndex: 1 | ||
equal: | ||
path: data["service-account.json"] | ||
value: Q2FybWVsYSBTb3ByYW5v | ||
- documentIndex: 1 | ||
equal: | ||
path: metadata.name | ||
value: credentials-staging | ||
- documentIndex: 1 | ||
equal: | ||
path: metadata.labels.team | ||
value: infra | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic work. You beat me to it!