Move storage tests to use the framework/log package

This is part of the transition to using framework/log instead
of the Logf inside the framework package. This will help with
import size/cycles when importing the framework or subpackages.
This commit is contained in:
John Schnake
2019-05-03 10:52:55 -05:00
parent d5245b9563
commit a6f5ebf831
43 changed files with 311 additions and 271 deletions

View File

@@ -27,6 +27,7 @@ import (
"k8s.io/apimachinery/pkg/util/rand"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/kubernetes/test/e2e/framework"
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
"k8s.io/kubernetes/test/e2e/storage/testpatterns"
"k8s.io/kubernetes/test/e2e/storage/utils"
imageutils "k8s.io/kubernetes/test/utils/image"
@@ -797,7 +798,7 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) {
By("Failing liveness probe")
out, err := podContainerExec(pod, 1, fmt.Sprintf("rm %v", probeFilePath))
framework.Logf("Pod exec output: %v", out)
e2elog.Logf("Pod exec output: %v", out)
Expect(err).ToNot(HaveOccurred(), "while failing liveness probe")
// Check that container has restarted
@@ -810,10 +811,10 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) {
}
for _, status := range pod.Status.ContainerStatuses {
if status.Name == pod.Spec.Containers[0].Name {
framework.Logf("Container %v, restarts: %v", status.Name, status.RestartCount)
e2elog.Logf("Container %v, restarts: %v", status.Name, status.RestartCount)
restarts = status.RestartCount
if restarts > 0 {
framework.Logf("Container has restart count: %v", restarts)
e2elog.Logf("Container has restart count: %v", restarts)
return true, nil
}
}
@@ -826,7 +827,7 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) {
By("Rewriting the file")
writeCmd := fmt.Sprintf("echo test-after > %v", probeFilePath)
out, err = podContainerExec(pod, 1, writeCmd)
framework.Logf("Pod exec output: %v", out)
e2elog.Logf("Pod exec output: %v", out)
Expect(err).ToNot(HaveOccurred(), "while rewriting the probe file")
// Wait for container restarts to stabilize
@@ -843,13 +844,13 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) {
if status.RestartCount == restarts {
stableCount++
if stableCount > stableThreshold {
framework.Logf("Container restart has stabilized")
e2elog.Logf("Container restart has stabilized")
return true, nil
}
} else {
restarts = status.RestartCount
stableCount = 0
framework.Logf("Container has restart count: %v", restarts)
e2elog.Logf("Container has restart count: %v", restarts)
}
break
}