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

[bug] - failedTemplate assertion is not working as expected #180

Closed
froy001 opened this issue Oct 24, 2022 · 2 comments · Fixed by #181
Closed

[bug] - failedTemplate assertion is not working as expected #180

froy001 opened this issue Oct 24, 2022 · 2 comments · Fixed by #181

Comments

@froy001
Copy link

froy001 commented Oct 24, 2022

I have a failedTempate assertion:

    asserts:
      - failedTemplate:
          errorMessage: |
             global.application.commit and global.application.remoteOrigin must be given if rookout.enabled = true 

I get the following assertion failure:

		- asserts[0] `failedTemplate` fail
			Template:	charts-integration-test/charts/app-01/templates/deployment.yaml
			Template:	charts-integration-test/charts/app-02/templates/deployment.yaml
			DocumentIndex:	0
			Expected to equal:
				global.application.commit and global.application.remoteOrigin must be given if rookout.enabled = true
			Actual:
				global.application.commit and global.application.remoteOrigin must be given if rookout.enabled = true

As can be seen the expected and the actual values are exactly the same. This could be related to #174

@rquinio1A
Copy link

Could you check there's no extra \n at the end of the message ? cf discussion in #155

@quintush
Copy link
Owner

quintush commented Nov 7, 2022

Hello @froy001,

Due to formatting the expected value seems to be equal to the actual value.
I have added an option --debug (-d) which should show the content without the formatting, showing the actual difference.
https://github.com/quintush/helm-unittest/blob/master/FAQ.md#debugging, describes the usage.

As for the above issue. When using the multi-line string (|), the text will always end with a line-ending (\n), resulting in a mismatch. The actual error will result in a single line string.

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.

3 participants