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

The chart.appVersion is not being applied #172

Closed
alvarezfr opened this issue Aug 29, 2022 · 2 comments · Fixed by #177
Closed

The chart.appVersion is not being applied #172

alvarezfr opened this issue Aug 29, 2022 · 2 comments · Fixed by #177
Assignees

Comments

@alvarezfr
Copy link

I think the problem is that the tool is getting the chart version defined in the file Chart.yml instead of my unittest configuration.

I have just installed the plugin with the command helm plugin install https://github.com/quintush/helm-unittest, so it should be updated but I cannot find the flag to see the version.

My config:

suite: Deployment
templates:
  - deployment.yaml
chart:
  version: v1.0.0
  appVersion: 2.0.0

tests:
- it: default
  asserts:
  - hasDocuments:
      count: 1
  - isKind:
      of: Deployment
  - equal:
      path: spec.template.spec
      value:
        affinity:
          podAntiAffinity:
            preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app.kubernetes.io/instance: RELEASE-NAME
                    app.kubernetes.io/managed-by: Helm
                    app.kubernetes.io/name: base
                    app.kubernetes.io/version: 2.0.0
                    helm.sh/chart: base-v1.0.0
                topologyKey: failure-domain.beta.kubernetes.io/zone
              weight: 80

The label app.kubernetes.io/version is generated with this _helper:

{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}

When I run the test, it shows this diff (1.3.1 is the appVersion in the Chart.yaml):

                                --- Expected
                                +++ Actual
                                @@ -9,3 +9,3 @@
                                             app.kubernetes.io/name: base
                                -            app.kubernetes.io/version: 2.0.0
                                +            app.kubernetes.io/version: 1.3.1
                                             helm.sh/chart: base-v1.0.0

Thank you!

@quintush
Copy link
Owner

Hello @alvarezfr,

I will look into it.
Did have some tests validating the behavior, but it seems my tests aren't fully covered.

Greetings,
@quintush

@quintush quintush self-assigned this Sep 25, 2022
@quintush
Copy link
Owner

Hello @alvarezfr,

I have found the issue and fixed it in the next release.

The yaml parsing was not identifying the appVersion text, so it always expected to be empty and so using the appVersion in the chart.

Greetings,
@quintush

@quintush quintush linked a pull request Oct 2, 2022 that will close this issue
@quintush quintush closed this as completed Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants