-
Notifications
You must be signed in to change notification settings - Fork 39k
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
fix mount unmount failure for a Windows pod #63272
fix mount unmount failure for a Windows pod #63272
Conversation
/test pull-kubernetes-cross |
1c1dfda
to
4e92e60
Compare
pkg/util/mount/mount_windows_test.go
Outdated
|
||
for _, test := range tests { | ||
filePath := filepath.Join(base, test.fileName) | ||
if test.fileValid { |
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 potentially pass in a setup method per test case, instead of combining all the scenarios here, to make it easier to comprehend each test case separately.
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.
@msau42 thanks for the suggestion, I have made a new commit with setUp func, the test code is more clear now
4e92e60
to
f3698b0
Compare
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.
@msau42 thanks for the suggestion, I have made a new commit with setUp func, the test code is more clear now
pkg/util/mount/mount_windows_test.go
Outdated
|
||
for _, test := range tests { | ||
filePath := filepath.Join(base, test.fileName) | ||
if test.fileValid { |
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.
@msau42 thanks for the suggestion, I have made a new commit with setUp func, the test code is more clear now
/test pull-kubernetes-cross |
/test pull-kubernetes-verify |
2 similar comments
/test pull-kubernetes-verify |
/test pull-kubernetes-verify |
@msau42 PTAL, thanks. |
pkg/util/mount/mount_windows_test.go
Outdated
|
||
func TestIsLikelyNotMountPoint(t *testing.T) { | ||
mounter := Mounter{"fake/path"} | ||
base, err := ioutil.TempDir("", "TestIsLikelyNotMountPoint") |
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.
Should you make the TempDir per test case so that you won't run into name collision issues?
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.
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 actually mean each test case in tests uses a new tmpdir. That way you don't need to rely on each test case filename to be unique
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.
Hi @msau42 actually ioutil.TempDir("", "")
will create a new tmpdir with a unique name, add a prefix like "TestIsLikelyNotMountPoint"
is for debugging purpose, so when it fails, I could comment out defer os.RemoveAll(base)
and find the tmp directory easily. Anyway, whether I set prefix or not, ioutil.TempDir
will still create a unique dir.
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.
Sorry I think I'm not being clear. I was suggesting a new tempdir for each iteration in the testcase loop
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.
@msau42 good point, I have changed the test case, create a new tempdir for every single test case, PTAL
f3698b0
to
51b0649
Compare
fix comments fix comments on unit test fix comments
51b0649
to
1d24f48
Compare
/lgtm |
/test pull-kubernetes-e2e-gce |
/assign @jsafrane PTAL, thanks |
/test pull-kubernetes-bazel-test |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andyzhangx, jsafrane, msau42 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 |
/test all [submit-queue is verifying that this PR is safe to merge] |
/test pull-kubernetes-integration |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
…ase-1.10' of https://github.com/andyzhangx/kubernetes into automated-cherry-pick-of-kubernetes#63272-upstream-release-1.10
What this PR does / why we need it:
IsLikelyNotMountPoint
func does not return correctly, for invalid symlink, it should return true(not a mount point), now it will always return false:kubernetes/pkg/util/mount/mount_windows.go
Lines 141 to 148 in 7711d88
kubernetes/pkg/volume/util/util.go
Lines 147 to 163 in 7711d88
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #63249
Special notes for your reviewer:
Release note:
/sig windows
/assign @msau42