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
[Studio][Tests] Use absolute drive path for windows studio name #6645
Conversation
Signed-off-by: Scott Macfarlane <smacfarlane@chef.io>
Hello smacfarlane! Thanks for the pull request! Here is what will happen next:
Thank you for contributing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is outside my area of familiarity
@@ -8,7 +8,7 @@ $env:HAB_NOCOLORING = "true" | |||
# Await has trouble parsing non-ascii glyphs | |||
$env:HAB_GLYPH_STYLE = "ascii" | |||
$exit_code = 0 | |||
$studio_name = "/hab/studios/studio-internals-test" | |||
$studio_name = "c:\hab\studios\studio-internals-test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine our purposes here and indeed almost any scenario. I always like to use:
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("/some/path/I/want/to/cannonacalize")
This will always transform the given string to a Windows friendly absolute path whether or not the path actually exists and applicable to one's current context. In otherwords, if you were in the d:\
drive, this would resolve to the d
drive.
Note there is also the simpler and more intuitively named Resolve-Path
which does the same thing but requires the given path to exist. If I know or expect the path to already exist, I prefer this command.
# Add the same behavior for `hab studio rm` to ensure that the studio is fully cleaned up before | ||
# stopping the Await session. | ||
$retry = 0 | ||
while(($retry -lt 10) -and (Test-Path "$studio_name")) { | ||
while(($retry -lt 5) -and (Test-Path "$studio_name")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still like keeping this to a higher number because if we reach the limit, subsequently deleting the studio environment is guaranteed to fail because of open file handles from the hab binary.
Signed-off-by: Scott Macfarlane <smacfarlane@chef.io>
Obvious fix; these changes are the result of automation not creative thinking.
When exiting the studio inside an Await session, the CWD would remain at the
[Habitat]
junction location. This caused the Linux style path of/hab/studios/studio-internals-test
to not be resolvable and the studio rm would fail, resulting in a failing test.This changes the studio name to use Windows-style drive letter paths, allowing the
hab studio rm
to behave as expected.Signed-off-by: Scott Macfarlane smacfarlane@chef.io