Address staticcheck failures for test/e2e/node/...

Fix the `staticcheck` failures for `test/e2e/node`. All of the
staticcheck errors were for variables which were never used. When these
values were `err`, we added processing for the errors. When they were
values that were just never used, we stopped giving them a name.
This commit is contained in:
mattjmcnaughton 2019-10-09 10:26:11 -04:00
parent 8577711b61
commit 69a473be38
No known key found for this signature in database
GPG Key ID: BC530981A9A1CC9D
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))
}