@@ -100,14 +100,14 @@ func doReadOnlyTest(f *framework.Framework, source v1.VolumeSource, volumePath s
100
100
101
101
cmd := []string {"cmd" , "/c" , "echo windows-volume-test" , ">" , filePath }
102
102
103
+ ginkgo .By ("verifying that pod will get an error when writing to a volume that is readonly" )
103
104
_ , stderr , _ := f .ExecCommandInContainerWithFullOutput (podName , containerName , cmd ... )
104
-
105
105
framework .ExpectEqual (stderr , "Access is denied." )
106
106
}
107
107
108
108
func doReadWriteReadOnlyTest (f * framework.Framework , source v1.VolumeSource , volumePath string ) {
109
109
var (
110
- filePath = volumePath + "\\ test-file"
110
+ filePath = volumePath + "\\ test-file" + string ( uuid . NewUUID ())
111
111
podName = "pod-" + string (uuid .NewUUID ())
112
112
pod = testPodWithROVolume (podName , source , volumePath )
113
113
rwcontainerName = containerName + "-rw"
@@ -133,15 +133,17 @@ func doReadWriteReadOnlyTest(f *framework.Framework, source v1.VolumeSource, vol
133
133
ginkgo .By ("verifying that pod has the correct nodeSelector" )
134
134
framework .ExpectEqual (pod .Spec .NodeSelector ["kubernetes.io/os" ], "windows" )
135
135
136
- cmd := [] string { "cmd" , "/c" , "echo windows- volume-test" , ">" , filePath }
137
-
138
- stdoutRW , stderrRW , errRW := f .ExecCommandInContainerWithFullOutput (podName , rwcontainerName , cmd ... )
139
- msg := fmt .Sprintf ("cmd: %v, stdout: %q, stderr: %q" , cmd , stdoutRW , stderrRW )
136
+ ginkgo . By ( "verifying that pod can write to a volume with read/write access" )
137
+ writecmd := [] string { "cmd" , "/c" , "echo windows-volume-test" , ">" , filePath }
138
+ stdoutRW , stderrRW , errRW := f .ExecCommandInContainerWithFullOutput (podName , rwcontainerName , writecmd ... )
139
+ msg := fmt .Sprintf ("cmd: %v, stdout: %q, stderr: %q" , writecmd , stdoutRW , stderrRW )
140
140
framework .ExpectNoError (errRW , msg )
141
141
142
- _ , stderr , _ := f .ExecCommandInContainerWithFullOutput (podName , containerName , cmd ... )
142
+ ginkgo .By ("verifying that pod will get an error when writing to a volume that is readonly" )
143
+ _ , stderr , _ := f .ExecCommandInContainerWithFullOutput (podName , containerName , writecmd ... )
143
144
framework .ExpectEqual (stderr , "Access is denied." )
144
145
146
+ ginkgo .By ("verifying that pod can read from the the volume that is readonly" )
145
147
readcmd := []string {"cmd" , "/c" , "type" , filePath }
146
148
readout , readerr , err := f .ExecCommandInContainerWithFullOutput (podName , containerName , readcmd ... )
147
149
readmsg := fmt .Sprintf ("cmd: %v, stdout: %q, stderr: %q" , readcmd , readout , readerr )
0 commit comments