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

Snapshot tests always pass before --update is run #246

Open
pete-woods opened this issue Nov 24, 2023 · 2 comments
Open

Snapshot tests always pass before --update is run #246

pete-woods opened this issue Nov 24, 2023 · 2 comments
Assignees

Comments

@pete-woods
Copy link

pete-woods commented Nov 24, 2023

(version: 0.3.6)

When adding a new snapshot test, the tests always seem to pass if no snapshot has been created yet.

E.g. if I add a test case like this:

  - it: should do some stuff
    set:
      deployment:
        name: hello
    asserts:
      - matchSnapshot: {}

running helm unittest ... results in a pass.

So if I change something, e.g.:

  - it: should do some stuff
    set:
      deployment:
        name: goodbye
    asserts:
      - matchSnapshot: {}

the tests still pass.

It's only after I run with -u, and a snapshot is generated, that I can get a test failure.

It seems like a fairly serious bug, as you can get things into production thinking you've not changed your snapshots, but really you have.

Probably the match snapshot func should always fail if no snapshot is found.

@pete-woods pete-woods changed the title Snapshot tests seem to Snapshot tests always pass before --update is run the first time Nov 24, 2023
@pete-woods pete-woods changed the title Snapshot tests always pass before --update is run the first time Snapshot tests always pass before --update is run Nov 24, 2023
@quintush quintush self-assigned this Mar 21, 2024
@ryanvana
Copy link

ryanvana commented May 1, 2024

An example of where this is a problem

{{- if .Values.feature.enabled --}}
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
  name: {{ .Values.name }}
  namespace: {{ .Values.namespace }}
  labels:
    app: {{ .Values.name }}
    deploymentName: {{ .Values.name }}
spec:
  env: {{ toYaml .Values.env | nindent 4 }}
{{- end -}}

Changing the feature.enabled property will cause the snapshot to update.

@ryanvana
Copy link

Would you be open to accepting pull requests for this issue?

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

No branches or pull requests

3 participants