-
Notifications
You must be signed in to change notification settings - Fork 244
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
use linux path separator for commands executed on pod #3524
use linux path separator for commands executed on pod #3524
Conversation
tests/integration/cmd_push_test.go
Outdated
@@ -286,7 +288,7 @@ var _ = Describe("odo push command tests", func() { | |||
cmpName, | |||
appName, | |||
project, | |||
[]string{"stat", filepath.Join(dir, "src", "server.js")}, | |||
[]string{"stat", strings.TrimSuffix(dir, "/") + "/src/server.js"}, // this doesn't use filepath.Join for a reason as this commands needs to run on linux, but the host machine can be windows |
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.
Will ToSlash() work after the join operation?
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.
Didn’t get u? can u elaborate?
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.
It won’t because the host system would still be Windows which would give different slash the pod os - being linux
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.
It won’t because the host system would still be Windows which would give different slash the pod os - being linux
ToSlash
returns the path that always uses /
even on Windows
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.
you could use filepath.ToSlash(filepath.Join(.....))
this should be much safer
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.
We are already using ToSlash() in our code base for converting all paths to linux based paths https://github.com/openshift/odo/blob/7c0fef571f2ee1b0e3ad8927759b3efbb14f8616/pkg/sync/sync.go#L31
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.
done
/retest |
Codecov Report
@@ Coverage Diff @@
## master #3524 +/- ##
==========================================
- Coverage 46.27% 46.06% -0.21%
==========================================
Files 112 113 +1
Lines 11386 11437 +51
==========================================
Hits 5269 5269
- Misses 5608 5659 +51
Partials 509 509
Continue to review full report at Codecov.
|
4f5968f
to
63bd348
Compare
/approve Applying both since the PR is small and issues look addressed. |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dharmit, mik-dass The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@dharmit lets get a confirm from @amitkrout on windows. removing your lgtm so that he can do that. |
I am testing it on windows. Till then I am holding the pr. /hold |
I tested the pr on windows but the change doesn't solve the problem. Still I can see failure at the same point. Test logs:
|
@@ -367,7 +367,7 @@ var _ = Describe("odo push command tests", func() { | |||
"backend", | |||
appName, | |||
project, | |||
[]string{"stat", filepath.Join(dir, "src", "src", "main", "java", "AnotherMessageProducer.java")}, | |||
[]string{"stat", filepath.ToSlash(filepath.Join(dir, "src", "src", "main", "java", "AnotherMessageProducer.java"))}, |
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.
we need to use flepath.ToSlash() at https://github.com/openshift/odo/pull/3524/files#diff-e977fd6c6dedc4d8ed7367e136764033R378 also
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.
@girishramnani Adding filepath.ToSlash()
at line https://github.com/openshift/odo/pull/3524/files#diff-e977fd6c6dedc4d8ed7367e136764033R378 will really be helpful. I have added and tested it on windows with the current change. It works fine for me and purpose of the pr was also achieved.
Can you please add filepath.ToSlash()
for the requested line also? After that we are good to go 👍
thanks, doing that now |
Great 🙂 |
2a00b38
to
136b0e8
Compare
addressed |
I ran the test change on windows and it works fine.
/lgtm |
/retest Please review the full test history for this PR and help us cut down flakes. |
7 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
What type of PR is this?
What does does this PR do / why we need it:
use linux path separator for commands executed on pod instead of platform independent
filepath.Join
as the pod will always be linux but host machine can be windows. Would would join the paths in the commands incorrectly for linux.Which issue(s) this PR fixes:
Fixes #3328
How to test changes / Special notes to the reviewer:
failing tests mentioned in the above issue should pass on windows