mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #91742 from jingxu97/June/wintests
Fix subPath tests for Windows
This commit is contained in:
commit
c46c1c043e
@ -234,7 +234,7 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
|
||||
TestBasicSubpath(f, f.Namespace.Name, l.pod)
|
||||
})
|
||||
|
||||
ginkgo.It("should fail if subpath directory is outside the volume [Slow]", func() {
|
||||
ginkgo.It("should fail if subpath directory is outside the volume [Slow][LinuxOnly]", func() {
|
||||
init()
|
||||
defer cleanup()
|
||||
|
||||
@ -272,7 +272,7 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
|
||||
testPodFailSubpath(f, l.pod, false)
|
||||
})
|
||||
|
||||
ginkgo.It("should fail if subpath with backstepping is outside the volume [Slow]", func() {
|
||||
ginkgo.It("should fail if subpath with backstepping is outside the volume [Slow][LinuxOnly]", func() {
|
||||
init()
|
||||
defer cleanup()
|
||||
|
||||
@ -443,6 +443,7 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
|
||||
// Change volume container to busybox so we can exec later
|
||||
l.pod.Spec.Containers[1].Image = e2evolume.GetTestImage(imageutils.GetE2EImage(imageutils.BusyBox))
|
||||
l.pod.Spec.Containers[1].Command = e2evolume.GenerateScriptCmd("sleep 100000")
|
||||
l.pod.Spec.Containers[1].Args = nil
|
||||
|
||||
ginkgo.By(fmt.Sprintf("Creating pod %s", l.pod.Name))
|
||||
removeUnusedContainers(l.pod)
|
||||
@ -618,8 +619,9 @@ func SubpathTestPod(f *framework.Framework, subpath, volumeType string, source *
|
||||
}
|
||||
|
||||
func containerIsUnused(container *v1.Container) bool {
|
||||
// mountImage with nil Args or with just "mounttest" as Args does nothing. Leave everything else
|
||||
return container.Image == mountImage && (container.Args == nil || (len(container.Args) == 1 && container.Args[0] == "mounttest"))
|
||||
// mountImage with nil command and nil Args or with just "mounttest" as Args does nothing. Leave everything else
|
||||
return container.Image == mountImage && container.Command == nil &&
|
||||
(container.Args == nil || (len(container.Args) == 1 && container.Args[0] == "mounttest"))
|
||||
}
|
||||
|
||||
// removeUnusedContainers removes containers from a SubpathTestPod that aren't
|
||||
@ -830,9 +832,10 @@ func testPodContainerRestartWithHooks(f *framework.Framework, pod *v1.Pod, hooks
|
||||
|
||||
pod.Spec.Containers[0].Image = e2evolume.GetTestImage(imageutils.GetE2EImage(imageutils.BusyBox))
|
||||
pod.Spec.Containers[0].Command = e2evolume.GenerateScriptCmd("sleep 100000")
|
||||
pod.Spec.Containers[0].Args = nil
|
||||
pod.Spec.Containers[1].Image = e2evolume.GetTestImage(imageutils.GetE2EImage(imageutils.BusyBox))
|
||||
pod.Spec.Containers[1].Command = e2evolume.GenerateScriptCmd("sleep 100000")
|
||||
|
||||
pod.Spec.Containers[1].Args = nil
|
||||
hooks.AddLivenessProbe(pod, probeFilePath)
|
||||
|
||||
// Start pod
|
||||
@ -1003,9 +1006,10 @@ func testSubpathReconstruction(f *framework.Framework, hostExec utils.HostExec,
|
||||
// Change to busybox
|
||||
pod.Spec.Containers[0].Image = e2evolume.GetTestImage(imageutils.GetE2EImage(imageutils.BusyBox))
|
||||
pod.Spec.Containers[0].Command = e2evolume.GenerateScriptCmd("sleep 100000")
|
||||
pod.Spec.Containers[0].Args = nil
|
||||
pod.Spec.Containers[1].Image = e2evolume.GetTestImage(imageutils.GetE2EImage(imageutils.BusyBox))
|
||||
pod.Spec.Containers[1].Command = e2evolume.GenerateScriptCmd("sleep 100000")
|
||||
|
||||
pod.Spec.Containers[1].Args = nil
|
||||
// If grace period is too short, then there is not enough time for the volume
|
||||
// manager to cleanup the volumes
|
||||
gracePeriod := int64(30)
|
||||
|
Loading…
Reference in New Issue
Block a user