Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion hack/.staticcheck_failures
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/node/node_problem_detector.go
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/node/pod_gc.go
Expand Up @@ -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)
}
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/node/pre_stop.go
Expand Up @@ -223,6 +223,8 @@ var _ = SIGDescribe("PreStop", func() {
}
return false, err
})

framework.ExpectNoError(err, "validate-pod-is-running")
})
})

Expand Down
1 change: 1 addition & 0 deletions test/e2e/node/security_context.go
Expand Up @@ -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))
}