Stop throwing fatal error in buildGo to fix vm leak.

This commit is contained in:
Random-Liu 2016-08-16 18:02:43 -07:00
parent d412d5721d
commit 1c5bd5540e
4 changed files with 13 additions and 8 deletions

View File

@ -37,11 +37,11 @@ var buildTargets = []string{
"vendor/github.com/onsi/ginkgo/ginkgo",
}
func buildGo() {
func buildGo() error {
glog.Infof("Building k8s binaries...")
k8sRoot, err := getK8sRootDir()
if err != nil {
glog.Fatalf("Failed to locate kubernetes root directory %v.", err)
return fmt.Errorf("failed to locate kubernetes root directory %v.", err)
}
targets := strings.Join(buildTargets, " ")
cmd := exec.Command("make", "-C", k8sRoot, fmt.Sprintf("WHAT=%s", targets))
@ -49,8 +49,9 @@ func buildGo() {
cmd.Stderr = os.Stderr
err = cmd.Run()
if err != nil {
glog.Fatalf("Failed to build go packages %v\n", err)
return fmt.Errorf("failed to build go packages %v\n", err)
}
return nil
}
func getK8sBin(bin string) (string, error) {

View File

@ -101,7 +101,7 @@ func TestE2eNode(t *testing.T) {
// Setup the kubelet on the node
var _ = SynchronizedBeforeSuite(func() []byte {
if *buildServices {
buildGo()
Expect(buildGo()).To(Succeed())
}
if framework.TestContext.NodeName == "" {
hostname, err := os.Hostname()

View File

@ -82,12 +82,14 @@ func GetHostnameOrIp(hostname string) string {
// the binaries k8s required for node e2e tests
func CreateTestArchive() (string, error) {
// Build the executables
buildGo()
if err := buildGo(); err != nil {
return "", fmt.Errorf("failed to build the depedencies: %v", err)
}
// Make sure we can find the newly built binaries
buildOutputDir, err := getK8sBuildOutputDir()
if err != nil {
glog.Fatalf("Failed to locate kubernetes build output directory %v", err)
return "", fmt.Errorf("failed to locate kubernetes build output directory %v", err)
}
ginkgoTest := filepath.Join(buildOutputDir, "e2e_node.test")

View File

@ -502,9 +502,11 @@ func getComputeClient() (*compute.Service, error) {
}
func deleteInstance(image string) {
_, err := computeService.Instances.Delete(*project, *zone, imageToInstanceName(image)).Do()
instanceName := imageToInstanceName(image)
glog.Infof("Deleting instance %q", instanceName)
_, err := computeService.Instances.Delete(*project, *zone, instanceName).Do()
if err != nil {
glog.Infof("Error deleting instance %s", imageToInstanceName(image))
glog.Errorf("Error deleting instance %q: %v", instanceName, err)
}
}