mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
e2e: node: improve error logging
In the `restartKubelet` helper, we use `exec.Command`, whose return value is the output as the command, but as `[]byte`. The way we logged the output of the command was as value, making the output, meant to be human readable, unnecessarily hard to read. We fix this annoying behaviour converting the output to string before to log it out, making pretty obvious to understand the outcome of the command. Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
parent
d7f74ca58c
commit
e878c20ac7
@ -418,10 +418,10 @@ func restartKubelet() {
|
||||
kubeletServiceName := findKubletServiceName(false)
|
||||
// reset the kubelet service start-limit-hit
|
||||
stdout, err := exec.Command("sudo", "systemctl", "reset-failed", kubeletServiceName).CombinedOutput()
|
||||
framework.ExpectNoError(err, "Failed to reset kubelet start-limit-hit with systemctl: %v, %v", err, stdout)
|
||||
framework.ExpectNoError(err, "Failed to reset kubelet start-limit-hit with systemctl: %v, %s", err, string(stdout))
|
||||
|
||||
stdout, err = exec.Command("sudo", "systemctl", "restart", kubeletServiceName).CombinedOutput()
|
||||
framework.ExpectNoError(err, "Failed to restart kubelet with systemctl: %v, %v", err, stdout)
|
||||
framework.ExpectNoError(err, "Failed to restart kubelet with systemctl: %v, %s", err, string(stdout))
|
||||
}
|
||||
|
||||
// stopKubelet will kill the running kubelet, and returns a func that will restart the process again
|
||||
@ -430,14 +430,14 @@ func stopKubelet() func() {
|
||||
|
||||
// reset the kubelet service start-limit-hit
|
||||
stdout, err := exec.Command("sudo", "systemctl", "reset-failed", kubeletServiceName).CombinedOutput()
|
||||
framework.ExpectNoError(err, "Failed to reset kubelet start-limit-hit with systemctl: %v, %v", err, stdout)
|
||||
framework.ExpectNoError(err, "Failed to reset kubelet start-limit-hit with systemctl: %v, %s", err, string(stdout))
|
||||
|
||||
stdout, err = exec.Command("sudo", "systemctl", "kill", kubeletServiceName).CombinedOutput()
|
||||
framework.ExpectNoError(err, "Failed to stop kubelet with systemctl: %v, %v", err, stdout)
|
||||
framework.ExpectNoError(err, "Failed to stop kubelet with systemctl: %v, %s", err, string(stdout))
|
||||
|
||||
return func() {
|
||||
stdout, err := exec.Command("sudo", "systemctl", "start", kubeletServiceName).CombinedOutput()
|
||||
framework.ExpectNoError(err, "Failed to restart kubelet with systemctl: %v, %v", err, stdout)
|
||||
framework.ExpectNoError(err, "Failed to restart kubelet with systemctl: %v, %s", err, string(stdout))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user