Open ehaselwanter opened 6 years ago
Pretty sure this is a side effect of the fact that WinRM isn't an actual shell and so it'll never pick up the path change in the single run. I'll spend some time looking at this but pretty sure this isn't something we can do much about given it's how WinRM and such work.
what about simulating the converge & verify behaviour. terminate winrm session and create a new one. wonder if this the reason I had to get a login shell in inspec tests on linux as well. that would explain that too
I think I am running into this too, via installing a Chocolatey package (e.g. git) and then using Inspec to verify that git --version
returns a status of 0. It works when I run kitchen converge
and kitchen verify
separately, but not if I only run kitchen verify
.
Just curious if @ehaselwanter suggestion about terminating the WinRM session and creating a new one has any traction? Or, if there's any other ideas?
for now I ended up with adding the 'known' needed env/path values to the test execution. not ideal.
Description
I have a cookbook installing java on windows.
kitchen test
does not pick up the changed$env:PATH
in the verify/inspec step. Butkitchen converge && kitchen verify
workssimplified example code:
fails cause it does not find java, but the following works
Kitchen Version
ChefDK Version
If you are running test-kitchen via ChefDK,
chef --version
will provide additional relevent version details.Platform Version
macOS 10.13.3
Replication Case
anything which updates $env in converge
Kitchen Output
has
$env:PATH
and works.
has
$env:PATH
and fails with
does not. I guess there is a re-use of the open connection which does not receive the updated env. This is just a wild guess.
Kitchen Diagnose
not an issue I guess (and contains lots of internals I need to scrape first)