Merge pull request #83681 from mattjmcnaughton/mattjmcnaughton/fix-staticcheck-test-e2e-node

Address `staticcheck` failures for `test/e2e/node/...`
This commit is contained in:
Kubernetes Prow Robot 2019-10-09 14:51:07 -07:00 committed by GitHub
commit 4d6deea241
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 2 deletions

View File

@ -88,7 +88,6 @@ test/e2e/lifecycle
test/e2e/lifecycle/bootstrap
test/e2e/manifest
test/e2e/network
test/e2e/node
test/e2e/storage
test/e2e/storage/drivers
test/e2e/storage/testsuites

View File

@ -281,7 +281,9 @@ func getCPUStat(f *framework.Framework, host string) (usage, uptime float64) {
lines := strings.Split(result.Stdout, "\n")
usage, err = strconv.ParseFloat(lines[0], 64)
framework.ExpectNoError(err, "Cannot parse float for usage")
uptime, err = strconv.ParseFloat(lines[1], 64)
framework.ExpectNoError(err, "Cannot parse float for uptime")
// Convert from nanoseconds to seconds
usage *= 1e-9

View File

@ -39,9 +39,12 @@ var _ = SIGDescribe("Pod garbage collector [Feature:PodGarbageCollector] [Slow]"
var count int
for count < 1000 {
pod, err := createTerminatingPod(f)
if err != nil {
framework.Failf("err creating pod: %v", err)
}
pod.ResourceVersion = ""
pod.Status.Phase = v1.PodFailed
pod, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).UpdateStatus(pod)
_, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).UpdateStatus(pod)
if err != nil {
framework.Failf("err failing pod: %v", err)
}

View File

@ -223,6 +223,8 @@ var _ = SIGDescribe("PreStop", func() {
}
return false, err
})
framework.ExpectNoError(err, "validate-pod-is-running")
})
})

View File

@ -267,5 +267,6 @@ func testPodSELinuxLabeling(f *framework.Framework, hostIPC bool, hostPID bool)
framework.ExpectNoError(err, "Error waiting for pod to run %v", pod)
content, err = f.ReadFileViaContainer(pod.Name, "test-container", testFilePath)
framework.ExpectNoError(err, "Error reading file via container")
gomega.Expect(content).NotTo(gomega.ContainSubstring(testContent))
}