mirror of https://github.com/k3s-io/k3s
Merge pull request #74805 from HotelsDotCom/feature/remove-kubectl-binary
VolumeSubpathEnvExpansion alpha tests - change kubectl references to API callspull/564/head
commit
6b2882738b
|
@ -478,14 +478,14 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
|
||||||
|
|
||||||
By("creating a file in subpath")
|
By("creating a file in subpath")
|
||||||
cmd := "touch /volume_mount/mypath/foo/test.log"
|
cmd := "touch /volume_mount/mypath/foo/test.log"
|
||||||
_, err = framework.RunHostCmd(pod.Namespace, pod.Name, cmd)
|
_, _, err = f.ExecShellInPodWithFullOutput(pod.Name, cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Failf("expected to be able to write to subpath")
|
framework.Failf("expected to be able to write to subpath")
|
||||||
}
|
}
|
||||||
|
|
||||||
By("test for file in mounted path")
|
By("test for file in mounted path")
|
||||||
cmd = "test -f /subpath_mount/test.log"
|
cmd = "test -f /subpath_mount/test.log"
|
||||||
_, err = framework.RunHostCmd(pod.Namespace, pod.Name, cmd)
|
_, _, err = f.ExecShellInPodWithFullOutput(pod.Name, cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Failf("expected to be able to verify file")
|
framework.Failf("expected to be able to verify file")
|
||||||
}
|
}
|
||||||
|
@ -625,13 +625,13 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
|
||||||
|
|
||||||
By("test for subpath mounted with old value")
|
By("test for subpath mounted with old value")
|
||||||
cmd := "test -f /volume_mount/foo/test.log"
|
cmd := "test -f /volume_mount/foo/test.log"
|
||||||
_, err = framework.RunHostCmd(pod.Namespace, pod.Name, cmd)
|
_, _, err = f.ExecShellInPodWithFullOutput(pod.Name, cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Failf("expected to be able to verify old file exists")
|
framework.Failf("expected to be able to verify old file exists")
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = "test ! -f /volume_mount/newsubpath/test.log"
|
cmd = "test ! -f /volume_mount/newsubpath/test.log"
|
||||||
_, err = framework.RunHostCmd(pod.Namespace, pod.Name, cmd)
|
_, _, err = f.ExecShellInPodWithFullOutput(pod.Name, cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Failf("expected to be able to verify new file does not exist")
|
framework.Failf("expected to be able to verify new file does not exist")
|
||||||
}
|
}
|
||||||
|
@ -656,9 +656,9 @@ func testPodFailSubpath(f *framework.Framework, pod *v1.Pod) {
|
||||||
func waitForPodContainerRestart(f *framework.Framework, pod *v1.Pod, volumeMount string) {
|
func waitForPodContainerRestart(f *framework.Framework, pod *v1.Pod, volumeMount string) {
|
||||||
|
|
||||||
By("Failing liveness probe")
|
By("Failing liveness probe")
|
||||||
out, err := framework.RunKubectl("exec", fmt.Sprintf("--namespace=%s", pod.Namespace), pod.Name, "--container", pod.Spec.Containers[0].Name, "--", "/bin/sh", "-c", fmt.Sprintf("rm %v", volumeMount))
|
stdout, stderr, err := f.ExecShellInPodWithFullOutput(pod.Name, fmt.Sprintf("rm %v", volumeMount))
|
||||||
|
|
||||||
framework.Logf("Pod exec output: %v", out)
|
framework.Logf("Pod exec output: %v / %v", stdout, stderr)
|
||||||
Expect(err).ToNot(HaveOccurred(), "while failing liveness probe")
|
Expect(err).ToNot(HaveOccurred(), "while failing liveness probe")
|
||||||
|
|
||||||
// Check that container has restarted
|
// Check that container has restarted
|
||||||
|
@ -685,8 +685,8 @@ func waitForPodContainerRestart(f *framework.Framework, pod *v1.Pod, volumeMount
|
||||||
|
|
||||||
// Fix liveness probe
|
// Fix liveness probe
|
||||||
By("Rewriting the file")
|
By("Rewriting the file")
|
||||||
out, err = framework.RunKubectl("exec", fmt.Sprintf("--namespace=%s", pod.Namespace), pod.Name, "--container", pod.Spec.Containers[0].Name, "--", "/bin/sh", "-c", fmt.Sprintf("echo test-after > %v", volumeMount))
|
stdout, _, err = f.ExecShellInPodWithFullOutput(pod.Name, fmt.Sprintf("echo test-after > %v", volumeMount))
|
||||||
framework.Logf("Pod exec output: %v", out)
|
framework.Logf("Pod exec output: %v", stdout)
|
||||||
Expect(err).ToNot(HaveOccurred(), "while rewriting the probe file")
|
Expect(err).ToNot(HaveOccurred(), "while rewriting the probe file")
|
||||||
|
|
||||||
// Wait for container restarts to stabilize
|
// Wait for container restarts to stabilize
|
||||||
|
|
Loading…
Reference in New Issue