Merge pull request #55137 from andyzhangx/add-mountpath-tests

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

add windows mount path test

**What this PR does / why we need it**:
add windows mount path test, this PR is for https://github.com/kubernetes/kubernetes/pull/51240, which should include some tests.

**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 #55549

**Special notes for your reviewer**:

**Release note**:

```
none
```
This commit is contained in:
Kubernetes Submit Queue 2017-11-12 04:04:18 -08:00 committed by GitHub
commit 381cfee8cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3775,6 +3775,9 @@ func TestValidateVolumeMounts(t *testing.T) {
{Name: "abc-123", MountPath: "/baz"},
{Name: "abc-123", MountPath: "/baa", SubPath: ""},
{Name: "abc-123", MountPath: "/bab", SubPath: "baz"},
{Name: "abc-123", MountPath: "d:", SubPath: ""},
{Name: "abc-123", MountPath: "F:", SubPath: ""},
{Name: "abc-123", MountPath: "G:\\mount", SubPath: ""},
{Name: "abc-123", MountPath: "/bac", SubPath: ".baz"},
{Name: "abc-123", MountPath: "/bad", SubPath: "..baz"},
}
@ -3789,6 +3792,7 @@ func TestValidateVolumeMounts(t *testing.T) {
"relative mountpath": {{Name: "abc", MountPath: "bar"}},
"mountpath collision": {{Name: "foo", MountPath: "/path/a"}, {Name: "bar", MountPath: "/path/a"}},
"absolute subpath": {{Name: "abc", MountPath: "/bar", SubPath: "/baz"}},
"windows absolute subpath": {{Name: "abc", MountPath: "D", SubPath: ""}},
"subpath in ..": {{Name: "abc", MountPath: "/bar", SubPath: "../baz"}},
"subpath contains ..": {{Name: "abc", MountPath: "/bar", SubPath: "baz/../bat"}},
"subpath ends in ..": {{Name: "abc", MountPath: "/bar", SubPath: "./.."}},