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

Feat helm unittest #334

Merged
merged 18 commits into from
Feb 21, 2024
Merged

Feat helm unittest #334

merged 18 commits into from
Feb 21, 2024

Conversation

roytev
Copy link
Contributor

@roytev roytev commented Nov 14, 2023

what

  • Add unit tests to the helm chart with all of the values available.

why

  • Make the chart more robust.
  • Allow contributors to be more safe when introduce new features to the chart

tests

references

@roytev roytev changed the title interim Feat helm unittest Nov 14, 2023
Copy link
Member

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!

@@ -0,0 +1,48 @@
---
suite: test secret-aws for aws
Copy link
Member

Choose a reason for hiding this comment

The 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 }}

Copy link
Member

@GMartinez-Sisti GMartinez-Sisti Feb 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this job is added, then it needs to be removed from ct lint

helm-charts/ct.yaml

Lines 7 to 8 in f400585

additional-commands:
- helm unittest {{ .Path }}

Copy link
Member

@GMartinez-Sisti GMartinez-Sisti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome! Some minor remarks 😃

@@ -10,7 +10,7 @@ data:
key.pem: {{ required "githubApp.key is required if githubApp configuration is specified." .Values.githubApp.key | b64enc }}
github_secret: {{ required "githubApp.secret is required if githubApp configuration is specified." .Values.githubApp.secret | b64enc }}
{{- end}}
{{- if .Values.github.user }}
Copy link
Member

@GMartinez-Sisti GMartinez-Sisti Feb 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this makes sense, I would change this on a different PR. Also since there are other places where this can be improved [(example)](

{{- if .Values.github.user }}
- name: ATLANTIS_GH_USER
value: {{ required "github.user is required if github configuration is specified." .Values.github.user }}
- name: ATLANTIS_GH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "atlantis.vcsSecretName" . }}
key: github_token
- name: ATLANTIS_GH_WEBHOOK_SECRET
valueFrom:
secretKeyRef:
name: {{ template "atlantis.vcsSecretName" . }}
key: github_secret
{{- end }}
).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it will be taken in another pr

Comment on lines 38 to 45
"orgWhitelist":{
"type":"string",
"default":"<replace-me>",
"description":"Deprecated (see orgAllowlist) List of repositories from which Atlantis will accept webhooks. Accepts wildcard characters (`*`). Multiple values may be comma-separated.",
"examples":[
"github.com/myorg/*"
]
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another example of a change that would be better in a different PR 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be fixed in another pr

@roytev roytev marked this pull request as ready for review February 20, 2024 14:07
@roytev roytev requested a review from a team as a code owner February 20, 2024 14:07
@roytev roytev requested review from GenPage and removed request for a team February 20, 2024 14:07
@jamengual jamengual merged commit 2ee4d8c into runatlantis:main Feb 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit tests
5 participants