Skip to content

Commit 6b28827

Browse files
authored
Merge pull request kubernetes#74805 from HotelsDotCom/feature/remove-kubectl-binary
VolumeSubpathEnvExpansion alpha tests - change kubectl references to API calls
2 parents cfe4ca8 + 8828ccf commit 6b28827

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/e2e/common/expansion.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -478,14 +478,14 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
478478

479479
By("creating a file in subpath")
480480
cmd := "touch /volume_mount/mypath/foo/test.log"
481-
_, err = framework.RunHostCmd(pod.Namespace, pod.Name, cmd)
481+
_, _, err = f.ExecShellInPodWithFullOutput(pod.Name, cmd)
482482
if err != nil {
483483
framework.Failf("expected to be able to write to subpath")
484484
}
485485

486486
By("test for file in mounted path")
487487
cmd = "test -f /subpath_mount/test.log"
488-
_, err = framework.RunHostCmd(pod.Namespace, pod.Name, cmd)
488+
_, _, err = f.ExecShellInPodWithFullOutput(pod.Name, cmd)
489489
if err != nil {
490490
framework.Failf("expected to be able to verify file")
491491
}
@@ -625,13 +625,13 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
625625

626626
By("test for subpath mounted with old value")
627627
cmd := "test -f /volume_mount/foo/test.log"
628-
_, err = framework.RunHostCmd(pod.Namespace, pod.Name, cmd)
628+
_, _, err = f.ExecShellInPodWithFullOutput(pod.Name, cmd)
629629
if err != nil {
630630
framework.Failf("expected to be able to verify old file exists")
631631
}
632632

633633
cmd = "test ! -f /volume_mount/newsubpath/test.log"
634-
_, err = framework.RunHostCmd(pod.Namespace, pod.Name, cmd)
634+
_, _, err = f.ExecShellInPodWithFullOutput(pod.Name, cmd)
635635
if err != nil {
636636
framework.Failf("expected to be able to verify new file does not exist")
637637
}
@@ -656,9 +656,9 @@ func testPodFailSubpath(f *framework.Framework, pod *v1.Pod) {
656656
func waitForPodContainerRestart(f *framework.Framework, pod *v1.Pod, volumeMount string) {
657657

658658
By("Failing liveness probe")
659-
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))
659+
stdout, stderr, err := f.ExecShellInPodWithFullOutput(pod.Name, fmt.Sprintf("rm %v", volumeMount))
660660

661-
framework.Logf("Pod exec output: %v", out)
661+
framework.Logf("Pod exec output: %v / %v", stdout, stderr)
662662
Expect(err).ToNot(HaveOccurred(), "while failing liveness probe")
663663

664664
// Check that container has restarted
@@ -685,8 +685,8 @@ func waitForPodContainerRestart(f *framework.Framework, pod *v1.Pod, volumeMount
685685

686686
// Fix liveness probe
687687
By("Rewriting the file")
688-
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))
689-
framework.Logf("Pod exec output: %v", out)
688+
stdout, _, err = f.ExecShellInPodWithFullOutput(pod.Name, fmt.Sprintf("echo test-after > %v", volumeMount))
689+
framework.Logf("Pod exec output: %v", stdout)
690690
Expect(err).ToNot(HaveOccurred(), "while rewriting the probe file")
691691

692692
// Wait for container restarts to stabilize

0 commit comments

Comments
 (0)