mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 20:17:41 +00:00
Remove fatal error in e2e_node_suite_test.go
This commit is contained in:
parent
811fd94ead
commit
35aad1593f
@ -96,9 +96,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
|
||||
// Initialize node name here, so that the following code can get right node name.
|
||||
if framework.TestContext.NodeName == "" {
|
||||
hostname, err := os.Hostname()
|
||||
if err != nil {
|
||||
glog.Fatalf("Could not get node name: %v", err)
|
||||
}
|
||||
Expect(err).NotTo(HaveOccurred(), "should be able to get node name")
|
||||
framework.TestContext.NodeName = hostname
|
||||
}
|
||||
// Pre-pull the images tests depend on so we can fail immediately if there is an image pull issue
|
||||
@ -116,9 +114,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
|
||||
|
||||
if *startServices {
|
||||
e2es = NewE2EServices()
|
||||
if err := e2es.Start(); err != nil {
|
||||
glog.Fatalf("Unable to start node services: %v", err)
|
||||
}
|
||||
Expect(e2es.Start()).To(Succeed(), "should be able to start node services.")
|
||||
glog.Infof("Node services started. Running tests...")
|
||||
} else {
|
||||
glog.Infof("Running tests without starting services.")
|
||||
@ -132,16 +128,13 @@ var _ = SynchronizedBeforeSuite(func() []byte {
|
||||
commontest.CurrentSuite = commontest.NodeE2E
|
||||
|
||||
data, err := json.Marshal(&framework.TestContext.NodeTestContextType)
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed to serialize node test context: %v", err)
|
||||
}
|
||||
Expect(err).NotTo(HaveOccurred(), "should be able to serialize node test context.")
|
||||
|
||||
return data
|
||||
}, func(data []byte) {
|
||||
// The node test context is updated in the first function, update it on every test node.
|
||||
err := json.Unmarshal(data, &framework.TestContext.NodeTestContextType)
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed to deserialize node test context: %v", err)
|
||||
}
|
||||
Expect(err).NotTo(HaveOccurred(), "should be able to deserialize node test context.")
|
||||
})
|
||||
|
||||
// Tear down the kubelet on the node
|
||||
@ -164,9 +157,8 @@ func maskLocksmithdOnCoreos() {
|
||||
return
|
||||
}
|
||||
if bytes.Contains(data, []byte("ID=coreos")) {
|
||||
if output, err := exec.Command("sudo", "systemctl", "mask", "--now", "locksmithd").CombinedOutput(); err != nil {
|
||||
glog.Fatalf("Could not mask locksmithd: %v, output: %q", err, string(output))
|
||||
}
|
||||
output, err := exec.Command("sudo", "systemctl", "mask", "--now", "locksmithd").CombinedOutput()
|
||||
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("should be able to mask locksmithd - output: %q", string(output)))
|
||||
glog.Infof("Locksmithd is masked successfully")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user