Remove fatal error in e2e_node_suite_test.go

This commit is contained in:
Random-Liu 2016-08-18 16:03:02 -07:00
parent 811fd94ead
commit 35aad1593f

View File

@ -96,9 +96,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
// Initialize node name here, so that the following code can get right node name. // Initialize node name here, so that the following code can get right node name.
if framework.TestContext.NodeName == "" { if framework.TestContext.NodeName == "" {
hostname, err := os.Hostname() hostname, err := os.Hostname()
if err != nil { Expect(err).NotTo(HaveOccurred(), "should be able to get node name")
glog.Fatalf("Could not get node name: %v", err)
}
framework.TestContext.NodeName = hostname framework.TestContext.NodeName = hostname
} }
// Pre-pull the images tests depend on so we can fail immediately if there is an image pull issue // 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 { if *startServices {
e2es = NewE2EServices() e2es = NewE2EServices()
if err := e2es.Start(); err != nil { Expect(e2es.Start()).To(Succeed(), "should be able to start node services.")
glog.Fatalf("Unable to start node services: %v", err)
}
glog.Infof("Node services started. Running tests...") glog.Infof("Node services started. Running tests...")
} else { } else {
glog.Infof("Running tests without starting services.") glog.Infof("Running tests without starting services.")
@ -132,16 +128,13 @@ var _ = SynchronizedBeforeSuite(func() []byte {
commontest.CurrentSuite = commontest.NodeE2E commontest.CurrentSuite = commontest.NodeE2E
data, err := json.Marshal(&framework.TestContext.NodeTestContextType) data, err := json.Marshal(&framework.TestContext.NodeTestContextType)
if err != nil { Expect(err).NotTo(HaveOccurred(), "should be able to serialize node test context.")
glog.Fatalf("Failed to serialize node test context: %v", err)
}
return data return data
}, func(data []byte) { }, func(data []byte) {
// The node test context is updated in the first function, update it on every test node. // The node test context is updated in the first function, update it on every test node.
err := json.Unmarshal(data, &framework.TestContext.NodeTestContextType) err := json.Unmarshal(data, &framework.TestContext.NodeTestContextType)
if err != nil { Expect(err).NotTo(HaveOccurred(), "should be able to deserialize node test context.")
glog.Fatalf("Failed to deserialize node test context: %v", err)
}
}) })
// Tear down the kubelet on the node // Tear down the kubelet on the node
@ -164,9 +157,8 @@ func maskLocksmithdOnCoreos() {
return return
} }
if bytes.Contains(data, []byte("ID=coreos")) { if bytes.Contains(data, []byte("ID=coreos")) {
if output, err := exec.Command("sudo", "systemctl", "mask", "--now", "locksmithd").CombinedOutput(); err != nil { output, err := exec.Command("sudo", "systemctl", "mask", "--now", "locksmithd").CombinedOutput()
glog.Fatalf("Could not mask locksmithd: %v, output: %q", err, string(output)) Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("should be able to mask locksmithd - output: %q", string(output)))
}
glog.Infof("Locksmithd is masked successfully") glog.Infof("Locksmithd is masked successfully")
} }
} }