Unverified Commit e2f42845 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #74487 from danielqsj/window

Fix golint failures for e2e/windows
parents dba8300e a60365e6
...@@ -658,7 +658,6 @@ test/e2e/storage/drivers ...@@ -658,7 +658,6 @@ test/e2e/storage/drivers
test/e2e/storage/testsuites test/e2e/storage/testsuites
test/e2e/storage/utils test/e2e/storage/utils
test/e2e/storage/vsphere test/e2e/storage/vsphere
test/e2e/windows
test/e2e_kubeadm test/e2e_kubeadm
test/e2e_node test/e2e_node
test/e2e_node/builder test/e2e_node/builder
......
...@@ -32,20 +32,20 @@ import ( ...@@ -32,20 +32,20 @@ import (
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" "github.com/onsi/gomega"
) )
var _ = SIGDescribe("[Feature:Windows] Density [Serial] [Slow]", func() { var _ = SIGDescribe("[Feature:Windows] Density [Serial] [Slow]", func() {
f := framework.NewDefaultFramework("density-test-windows") f := framework.NewDefaultFramework("density-test-windows")
BeforeEach(func() { ginkgo.BeforeEach(func() {
// NOTE(vyta): these tests are Windows specific // NOTE(vyta): these tests are Windows specific
framework.SkipUnlessNodeOSDistroIs("windows") framework.SkipUnlessNodeOSDistroIs("windows")
}) })
Context("create a batch of pods", func() { ginkgo.Context("create a batch of pods", func() {
// TODO(coufon): the values are generous, set more precise limits with benchmark data // TODO(coufon): the values are generous, set more precise limits with benchmark data
// and add more tests // and add more tests
dTests := []densityTest{ dTests := []densityTest{
...@@ -66,7 +66,7 @@ var _ = SIGDescribe("[Feature:Windows] Density [Serial] [Slow]", func() { ...@@ -66,7 +66,7 @@ var _ = SIGDescribe("[Feature:Windows] Density [Serial] [Slow]", func() {
for _, testArg := range dTests { for _, testArg := range dTests {
itArg := testArg itArg := testArg
desc := fmt.Sprintf("latency/resource should be within limit when create %d pods with %v interval", itArg.podsNr, itArg.interval) desc := fmt.Sprintf("latency/resource should be within limit when create %d pods with %v interval", itArg.podsNr, itArg.interval)
It(desc, func() { ginkgo.It(desc, func() {
itArg.createMethod = "batch" itArg.createMethod = "batch"
runDensityBatchTest(f, itArg) runDensityBatchTest(f, itArg)
...@@ -114,15 +114,15 @@ func runDensityBatchTest(f *framework.Framework, testArg densityTest) (time.Dura ...@@ -114,15 +114,15 @@ func runDensityBatchTest(f *framework.Framework, testArg densityTest) (time.Dura
go controller.Run(stopCh) go controller.Run(stopCh)
defer close(stopCh) defer close(stopCh)
By("Creating a batch of pods") ginkgo.By("Creating a batch of pods")
// It returns a map['pod name']'creation time' containing the creation timestamps // It returns a map['pod name']'creation time' containing the creation timestamps
createTimes := createBatchPodWithRateControl(f, pods, testArg.interval) createTimes := createBatchPodWithRateControl(f, pods, testArg.interval)
By("Waiting for all Pods to be observed by the watch...") ginkgo.By("Waiting for all Pods to be observed by the watch...")
Eventually(func() bool { gomega.Eventually(func() bool {
return len(watchTimes) == testArg.podsNr return len(watchTimes) == testArg.podsNr
}, 10*time.Minute, 10*time.Second).Should(BeTrue()) }, 10*time.Minute, 10*time.Second).Should(gomega.BeTrue())
if len(watchTimes) < testArg.podsNr { if len(watchTimes) < testArg.podsNr {
framework.Failf("Timeout reached waiting for all Pods to be observed by the watch.") framework.Failf("Timeout reached waiting for all Pods to be observed by the watch.")
...@@ -138,7 +138,7 @@ func runDensityBatchTest(f *framework.Framework, testArg densityTest) (time.Dura ...@@ -138,7 +138,7 @@ func runDensityBatchTest(f *framework.Framework, testArg densityTest) (time.Dura
for name, create := range createTimes { for name, create := range createTimes {
watch, ok := watchTimes[name] watch, ok := watchTimes[name]
Expect(ok).To(Equal(true)) gomega.Expect(ok).To(gomega.Equal(true))
e2eLags = append(e2eLags, e2eLags = append(e2eLags,
framework.PodLatencyData{Name: name, Latency: watch.Time.Sub(create.Time)}) framework.PodLatencyData{Name: name, Latency: watch.Time.Sub(create.Time)})
...@@ -182,7 +182,7 @@ func newInformerWatchPod(f *framework.Framework, mutex *sync.Mutex, watchTimes m ...@@ -182,7 +182,7 @@ func newInformerWatchPod(f *framework.Framework, mutex *sync.Mutex, watchTimes m
checkPodRunning := func(p *v1.Pod) { checkPodRunning := func(p *v1.Pod) {
mutex.Lock() mutex.Lock()
defer mutex.Unlock() defer mutex.Unlock()
defer GinkgoRecover() defer ginkgo.GinkgoRecover()
if p.Status.Phase == v1.PodRunning { if p.Status.Phase == v1.PodRunning {
if _, found := watchTimes[p.Name]; !found { if _, found := watchTimes[p.Name]; !found {
...@@ -208,12 +208,12 @@ func newInformerWatchPod(f *framework.Framework, mutex *sync.Mutex, watchTimes m ...@@ -208,12 +208,12 @@ func newInformerWatchPod(f *framework.Framework, mutex *sync.Mutex, watchTimes m
cache.ResourceEventHandlerFuncs{ cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) { AddFunc: func(obj interface{}) {
p, ok := obj.(*v1.Pod) p, ok := obj.(*v1.Pod)
Expect(ok).To(Equal(true)) gomega.Expect(ok).To(gomega.Equal(true))
go checkPodRunning(p) go checkPodRunning(p)
}, },
UpdateFunc: func(oldObj, newObj interface{}) { UpdateFunc: func(oldObj, newObj interface{}) {
p, ok := newObj.(*v1.Pod) p, ok := newObj.(*v1.Pod)
Expect(ok).To(Equal(true)) gomega.Expect(ok).To(gomega.Equal(true))
go checkPodRunning(p) go checkPodRunning(p)
}, },
}, },
...@@ -288,14 +288,14 @@ func deletePodsSync(f *framework.Framework, pods []*v1.Pod) { ...@@ -288,14 +288,14 @@ func deletePodsSync(f *framework.Framework, pods []*v1.Pod) {
for _, pod := range pods { for _, pod := range pods {
wg.Add(1) wg.Add(1)
go func(pod *v1.Pod) { go func(pod *v1.Pod) {
defer GinkgoRecover() defer ginkgo.GinkgoRecover()
defer wg.Done() defer wg.Done()
err := f.PodClient().Delete(pod.ObjectMeta.Name, metav1.NewDeleteOptions(30)) err := f.PodClient().Delete(pod.ObjectMeta.Name, metav1.NewDeleteOptions(30))
Expect(err).NotTo(HaveOccurred()) gomega.Expect(err).NotTo(gomega.HaveOccurred())
Expect(framework.WaitForPodToDisappear(f.ClientSet, f.Namespace.Name, pod.ObjectMeta.Name, labels.Everything(), gomega.Expect(framework.WaitForPodToDisappear(f.ClientSet, f.Namespace.Name, pod.ObjectMeta.Name, labels.Everything(),
30*time.Second, 10*time.Minute)).NotTo(HaveOccurred()) 30*time.Second, 10*time.Minute)).NotTo(gomega.HaveOccurred())
}(pod) }(pod)
} }
wg.Wait() wg.Wait()
......
...@@ -18,6 +18,7 @@ package windows ...@@ -18,6 +18,7 @@ package windows
import "github.com/onsi/ginkgo" import "github.com/onsi/ginkgo"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool { func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-windows] "+text, body) return ginkgo.Describe("[sig-windows] "+text, body)
} }
...@@ -25,8 +25,8 @@ import ( ...@@ -25,8 +25,8 @@ import (
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" "github.com/onsi/gomega"
) )
const ( const (
...@@ -42,27 +42,27 @@ var ( ...@@ -42,27 +42,27 @@ var (
var _ = SIGDescribe("Hybrid cluster network", func() { var _ = SIGDescribe("Hybrid cluster network", func() {
f := framework.NewDefaultFramework("hybrid-network") f := framework.NewDefaultFramework("hybrid-network")
BeforeEach(func() { ginkgo.BeforeEach(func() {
framework.SkipUnlessNodeOSDistroIs("windows") framework.SkipUnlessNodeOSDistroIs("windows")
}) })
Context("for all supported CNIs", func() { ginkgo.Context("for all supported CNIs", func() {
It("should have stable networking for Linux and Windows pods", func() { ginkgo.It("should have stable networking for Linux and Windows pods", func() {
By("creating linux and windows pods") ginkgo.By("creating linux and windows pods")
linuxPod := createTestPod(f, linuxBusyBoxImage, linuxOS) linuxPod := createTestPod(f, linuxBusyBoxImage, linuxOS)
windowsPod := createTestPod(f, windowsBusyBoximage, windowsOS) windowsPod := createTestPod(f, windowsBusyBoximage, windowsOS)
By("checking connectivity to 8.8.8.8 53 (google.com) from Linux") ginkgo.By("checking connectivity to 8.8.8.8 53 (google.com) from Linux")
assertConsistentConnectivity(f, linuxPod.ObjectMeta.Name, linuxOS, linuxCheck("8.8.8.8", 53)) assertConsistentConnectivity(f, linuxPod.ObjectMeta.Name, linuxOS, linuxCheck("8.8.8.8", 53))
By("checking connectivity to www.google.com from Windows") ginkgo.By("checking connectivity to www.google.com from Windows")
assertConsistentConnectivity(f, windowsPod.ObjectMeta.Name, windowsOS, windowsCheck("www.google.com")) assertConsistentConnectivity(f, windowsPod.ObjectMeta.Name, windowsOS, windowsCheck("www.google.com"))
By("checking connectivity from Linux to Windows") ginkgo.By("checking connectivity from Linux to Windows")
assertConsistentConnectivity(f, linuxPod.ObjectMeta.Name, linuxOS, linuxCheck(windowsPod.Status.PodIP, 80)) assertConsistentConnectivity(f, linuxPod.ObjectMeta.Name, linuxOS, linuxCheck(windowsPod.Status.PodIP, 80))
By("checking connectivity from Windows to Linux") ginkgo.By("checking connectivity from Windows to Linux")
assertConsistentConnectivity(f, windowsPod.ObjectMeta.Name, windowsOS, windowsCheck(linuxPod.Status.PodIP)) assertConsistentConnectivity(f, windowsPod.ObjectMeta.Name, windowsOS, windowsCheck(linuxPod.Status.PodIP))
}) })
...@@ -77,11 +77,11 @@ var ( ...@@ -77,11 +77,11 @@ var (
) )
func assertConsistentConnectivity(f *framework.Framework, podName string, os string, cmd []string) { func assertConsistentConnectivity(f *framework.Framework, podName string, os string, cmd []string) {
Consistently(func() error { gomega.Consistently(func() error {
By(fmt.Sprintf("checking connectivity of %s-container in %s", os, podName)) ginkgo.By(fmt.Sprintf("checking connectivity of %s-container in %s", os, podName))
_, _, err := f.ExecCommandInContainerWithFullOutput(podName, os+"-container", cmd...) _, _, err := f.ExecCommandInContainerWithFullOutput(podName, os+"-container", cmd...)
return err return err
}, duration, pollInterval).ShouldNot(HaveOccurred()) }, duration, pollInterval).ShouldNot(gomega.HaveOccurred())
} }
func linuxCheck(address string, port int) []string { func linuxCheck(address string, port int) []string {
......
...@@ -20,21 +20,21 @@ import ( ...@@ -20,21 +20,21 @@ import (
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
) )
// NOTE(claudiub): Spawning Pods With HostNetwork enabled is not currently supported by Windows Kubelet. // NOTE(claudiub): Spawning Pods With HostNetwork enabled is not currently supported by Windows Kubelet.
// TODO(claudiub): Remove this test suite once this PR merges: // TODO(claudiub): Remove this test suite once this PR merges:
// https://github.com/kubernetes/kubernetes/pull/69525 // https://github.com/kubernetes/kubernetes/pull/69525
var _ = Describe("[sig-network] [sig-windows] Networking", func() { var _ = ginkgo.Describe("[sig-network] [sig-windows] Networking", func() {
f := framework.NewDefaultFramework("pod-network-test") f := framework.NewDefaultFramework("pod-network-test")
BeforeEach(func() { ginkgo.BeforeEach(func() {
// NOTE(claudiub): These tests are Windows specific. // NOTE(claudiub): These tests are Windows specific.
framework.SkipUnlessNodeOSDistroIs("windows") framework.SkipUnlessNodeOSDistroIs("windows")
}) })
Describe("Granular Checks: Pods", func() { ginkgo.Describe("Granular Checks: Pods", func() {
// Try to hit all endpoints through a test container, retry 5 times, // Try to hit all endpoints through a test container, retry 5 times,
// expect exactly one unique hostname. Each of these endpoints reports // expect exactly one unique hostname. Each of these endpoints reports
...@@ -45,7 +45,7 @@ var _ = Describe("[sig-network] [sig-windows] Networking", func() { ...@@ -45,7 +45,7 @@ var _ = Describe("[sig-network] [sig-windows] Networking", func() {
Description: Create a hostexec pod that is capable of curl to netcat commands. Create a test Pod that will act as a webserver front end exposing ports 8080 for tcp and 8081 for udp. The netserver service proxies are created on specified number of nodes. Description: Create a hostexec pod that is capable of curl to netcat commands. Create a test Pod that will act as a webserver front end exposing ports 8080 for tcp and 8081 for udp. The netserver service proxies are created on specified number of nodes.
The kubectl exec on the webserver container MUST reach a http port on the each of service proxy endpoints in the cluster and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames. The kubectl exec on the webserver container MUST reach a http port on the each of service proxy endpoints in the cluster and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames.
*/ */
It("should function for intra-pod communication: http", func() { ginkgo.It("should function for intra-pod communication: http", func() {
config := framework.NewCoreNetworkingTestConfig(f, false) config := framework.NewCoreNetworkingTestConfig(f, false)
for _, endpointPod := range config.EndpointPods { for _, endpointPod := range config.EndpointPods {
config.DialFromTestContainer("http", endpointPod.Status.PodIP, framework.EndpointHttpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name)) config.DialFromTestContainer("http", endpointPod.Status.PodIP, framework.EndpointHttpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
...@@ -58,7 +58,7 @@ var _ = Describe("[sig-network] [sig-windows] Networking", func() { ...@@ -58,7 +58,7 @@ var _ = Describe("[sig-network] [sig-windows] Networking", func() {
Description: Create a hostexec pod that is capable of curl to netcat commands. Create a test Pod that will act as a webserver front end exposing ports 8080 for tcp and 8081 for udp. The netserver service proxies are created on specified number of nodes. Description: Create a hostexec pod that is capable of curl to netcat commands. Create a test Pod that will act as a webserver front end exposing ports 8080 for tcp and 8081 for udp. The netserver service proxies are created on specified number of nodes.
The kubectl exec on the webserver container MUST reach a udp port on the each of service proxy endpoints in the cluster and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames. The kubectl exec on the webserver container MUST reach a udp port on the each of service proxy endpoints in the cluster and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames.
*/ */
It("should function for intra-pod communication: udp", func() { ginkgo.It("should function for intra-pod communication: udp", func() {
config := framework.NewCoreNetworkingTestConfig(f, false) config := framework.NewCoreNetworkingTestConfig(f, false)
for _, endpointPod := range config.EndpointPods { for _, endpointPod := range config.EndpointPods {
config.DialFromTestContainer("udp", endpointPod.Status.PodIP, framework.EndpointUdpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name)) config.DialFromTestContainer("udp", endpointPod.Status.PodIP, framework.EndpointUdpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
...@@ -71,7 +71,7 @@ var _ = Describe("[sig-network] [sig-windows] Networking", func() { ...@@ -71,7 +71,7 @@ var _ = Describe("[sig-network] [sig-windows] Networking", func() {
Description: Create a hostexec pod that is capable of curl to netcat commands. Create a test Pod that will act as a webserver front end exposing ports 8080 for tcp and 8081 for udp. The netserver service proxies are created on specified number of nodes. Description: Create a hostexec pod that is capable of curl to netcat commands. Create a test Pod that will act as a webserver front end exposing ports 8080 for tcp and 8081 for udp. The netserver service proxies are created on specified number of nodes.
The kubectl exec on the webserver container MUST reach a http port on the each of service proxy endpoints in the cluster using a http post(protocol=tcp) and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames. The kubectl exec on the webserver container MUST reach a http port on the each of service proxy endpoints in the cluster using a http post(protocol=tcp) and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames.
*/ */
It("should function for node-pod communication: http", func() { ginkgo.It("should function for node-pod communication: http", func() {
config := framework.NewCoreNetworkingTestConfig(f, false) config := framework.NewCoreNetworkingTestConfig(f, false)
for _, endpointPod := range config.EndpointPods { for _, endpointPod := range config.EndpointPods {
config.DialFromNode("http", endpointPod.Status.PodIP, framework.EndpointHttpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name)) config.DialFromNode("http", endpointPod.Status.PodIP, framework.EndpointHttpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
...@@ -84,7 +84,7 @@ var _ = Describe("[sig-network] [sig-windows] Networking", func() { ...@@ -84,7 +84,7 @@ var _ = Describe("[sig-network] [sig-windows] Networking", func() {
Description: Create a hostexec pod that is capable of curl to netcat commands. Create a test Pod that will act as a webserver front end exposing ports 8080 for tcp and 8081 for udp. The netserver service proxies are created on specified number of nodes. Description: Create a hostexec pod that is capable of curl to netcat commands. Create a test Pod that will act as a webserver front end exposing ports 8080 for tcp and 8081 for udp. The netserver service proxies are created on specified number of nodes.
The kubectl exec on the webserver container MUST reach a http port on the each of service proxy endpoints in the cluster using a http post(protocol=udp) and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames. The kubectl exec on the webserver container MUST reach a http port on the each of service proxy endpoints in the cluster using a http post(protocol=udp) and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames.
*/ */
It("should function for node-pod communication: udp", func() { ginkgo.It("should function for node-pod communication: udp", func() {
config := framework.NewCoreNetworkingTestConfig(f, false) config := framework.NewCoreNetworkingTestConfig(f, false)
for _, endpointPod := range config.EndpointPods { for _, endpointPod := range config.EndpointPods {
config.DialFromNode("udp", endpointPod.Status.PodIP, framework.EndpointUdpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name)) config.DialFromNode("udp", endpointPod.Status.PodIP, framework.EndpointUdpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
......
...@@ -25,8 +25,8 @@ import ( ...@@ -25,8 +25,8 @@ import (
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image" imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" "github.com/onsi/gomega"
) )
const ( const (
...@@ -55,27 +55,27 @@ var _ = SIGDescribe("Windows volume mounts ", func() { ...@@ -55,27 +55,27 @@ var _ = SIGDescribe("Windows volume mounts ", func() {
}, },
} }
) )
BeforeEach(func() { ginkgo.BeforeEach(func() {
framework.SkipUnlessNodeOSDistroIs("windows") framework.SkipUnlessNodeOSDistroIs("windows")
}) })
Context("check volume mount permissions", func() { ginkgo.Context("check volume mount permissions", func() {
It("container should have readOnly permissions on emptyDir", func() { ginkgo.It("container should have readOnly permissions on emptyDir", func() {
By("creating a container with readOnly permissions on emptyDir volume") ginkgo.By("creating a container with readOnly permissions on emptyDir volume")
doReadOnlyTest(f, emptyDirSource, emptyDirVolumePath) doReadOnlyTest(f, emptyDirSource, emptyDirVolumePath)
By("creating two containers, one with readOnly permissions the other with read-write permissions on emptyDir volume") ginkgo.By("creating two containers, one with readOnly permissions the other with read-write permissions on emptyDir volume")
doReadWriteReadOnlyTest(f, emptyDirSource, emptyDirVolumePath) doReadWriteReadOnlyTest(f, emptyDirSource, emptyDirVolumePath)
}) })
It("container should have readOnly permissions on hostMapPath", func() { ginkgo.It("container should have readOnly permissions on hostMapPath", func() {
By("creating a container with readOnly permissions on hostMap volume") ginkgo.By("creating a container with readOnly permissions on hostMap volume")
doReadOnlyTest(f, hostMapSource, hostMapPath) doReadOnlyTest(f, hostMapSource, hostMapPath)
By("creating two containers, one with readOnly permissions the other with read-write permissions on hostMap volume") ginkgo.By("creating two containers, one with readOnly permissions the other with read-write permissions on hostMap volume")
doReadWriteReadOnlyTest(f, hostMapSource, hostMapPath) doReadWriteReadOnlyTest(f, hostMapSource, hostMapPath)
}) })
...@@ -95,7 +95,7 @@ func doReadOnlyTest(f *framework.Framework, source v1.VolumeSource, volumePath s ...@@ -95,7 +95,7 @@ func doReadOnlyTest(f *framework.Framework, source v1.VolumeSource, volumePath s
_, stderr, _ := f.ExecCommandInContainerWithFullOutput(podName, containerName, cmd...) _, stderr, _ := f.ExecCommandInContainerWithFullOutput(podName, containerName, cmd...)
Expect(stderr).To(Equal("Access is denied.")) gomega.Expect(stderr).To(gomega.Equal("Access is denied."))
} }
...@@ -123,18 +123,18 @@ func doReadWriteReadOnlyTest(f *framework.Framework, source v1.VolumeSource, vol ...@@ -123,18 +123,18 @@ func doReadWriteReadOnlyTest(f *framework.Framework, source v1.VolumeSource, vol
cmd := []string{"cmd", "/c", "echo windows-volume-test", ">", filePath} cmd := []string{"cmd", "/c", "echo windows-volume-test", ">", filePath}
stdout_rw, stderr_rw, err_rw := f.ExecCommandInContainerWithFullOutput(podName, rwcontainerName, cmd...) stdoutRW, stderrRW, errRW := f.ExecCommandInContainerWithFullOutput(podName, rwcontainerName, cmd...)
msg := fmt.Sprintf("cmd: %v, stdout: %q, stderr: %q", cmd, stdout_rw, stderr_rw) msg := fmt.Sprintf("cmd: %v, stdout: %q, stderr: %q", cmd, stdoutRW, stderrRW)
Expect(err_rw).NotTo(HaveOccurred(), msg) gomega.Expect(errRW).NotTo(gomega.HaveOccurred(), msg)
_, stderr, _ := f.ExecCommandInContainerWithFullOutput(podName, containerName, cmd...) _, stderr, _ := f.ExecCommandInContainerWithFullOutput(podName, containerName, cmd...)
Expect(stderr).To(Equal("Access is denied.")) gomega.Expect(stderr).To(gomega.Equal("Access is denied."))
readcmd := []string{"cmd", "/c", "type", filePath} readcmd := []string{"cmd", "/c", "type", filePath}
readout, readerr, err := f.ExecCommandInContainerWithFullOutput(podName, containerName, readcmd...) readout, readerr, err := f.ExecCommandInContainerWithFullOutput(podName, containerName, readcmd...)
readmsg := fmt.Sprintf("cmd: %v, stdout: %q, stderr: %q", readcmd, readout, readerr) readmsg := fmt.Sprintf("cmd: %v, stdout: %q, stderr: %q", readcmd, readout, readerr)
Expect(readout).To(Equal("windows-volume-test")) gomega.Expect(readout).To(gomega.Equal("windows-volume-test"))
Expect(err).NotTo(HaveOccurred(), readmsg) gomega.Expect(err).NotTo(gomega.HaveOccurred(), readmsg)
} }
func testPodWithROVolume(podName string, source v1.VolumeSource, path string) *v1.Pod { func testPodWithROVolume(podName string, source v1.VolumeSource, path string) *v1.Pod {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment