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

Setting vars value with result of a step does not seem to evaluate #774

Open
1am opened this issue Mar 8, 2024 · 6 comments
Open

Setting vars value with result of a step does not seem to evaluate #774

1am opened this issue Mar 8, 2024 · 6 comments

Comments

@1am
Copy link

1am commented Mar 8, 2024

Hello, I'm using Version v1.1.0 and needed to use the feature documented in vars.yml test. It wasn't working for me in my test so I coped the test testcase and it also fails with the following

$ venom run vars.yml -vvvv
	  [trac] writing venom.12.log
 • Variables testsuite (vars.yml)
 	• CreateService
 		• exec PASS
	  	  [trac] writing vars.CreateService.step.0.0.dump.json
 	• WriteServiceIdForNextTestSuites
 		• exec PASS
	  	  [trac] writing vars.WriteServiceIdForNextTestSuites.step.0.0.dump.json
 	• echo_myvar
 		• exec FAIL
 		  Testcase "echo_myvar", step #0-0: Assertion "result.systemout ShouldContainSubstring foo" failed. expected '{{.myvar}}' to contain 'foo' but it wasn't (vars.yml:34)
	  	  [info] {{.myvar}} (vars.yml:30)
	  	  [trac] writing vars.echo_myvar.step.0.0.dump.json
final status: FAIL

What am I doing wrong and is there a way to work around this? I need to pass an ID from one step into bodyfile of a subsequent step which posts a JSON file which includes ID. I hoped to use the vars.yml test mechanism for this.

@FloRichardAloeCorp
Copy link

The feature works but the example seems broken. Can you share your test to see what you are doing wrong ?

@1am
Copy link
Author

1am commented Mar 11, 2024

My example was somewhat more specific version of vars.yml but even if it would work it would help.
In the end what I was aiming at (out of scope of this issue I guess) was similar to tests/http_post_bodyfile.yaml in which my template file placeholders would be populated with values set after first step of the test.

@ivan-velasco
Copy link
Contributor

@1am Have you tried version https://github.com/ovh/venom/releases/tag/v1.2.0-beta.4

New changes to vars

@1am
Copy link
Author

1am commented Mar 18, 2024

Just tried updating to 1.2.0-beta.4 and the result is the same: Testcase "echo_myvar", step #0-0: Assertion "result.systemout ShouldContainSubstring foo" failed. expected '{{.myvar}}' to contain 'foo' but it wasn't (vars.yml:34) when running vars.yml

@yesnault
Copy link
Member

Hi @1am , can you provide a full reproducer please?

@1am
Copy link
Author

1am commented Mar 30, 2024

Hello @yesnault The full reproducer was an exact copy of vars.yml without any changes.

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

4 participants