zone := testContext.CloudConfig.Zone region, err := gcecloud.GetGCERegion(zone) if err != nil { <del> glog.Fatalf("error parsing GCE region from zone %q: %v", zone, err) </del> <ins> return fmt.Errorf("error parsing GCE/GKE region from zone %q: %v", zone, err) </ins> } managedZones := []string{zone} // Only single-zone for now cloudConfig.Provider, err = gcecloud.CreateGCECloud(testContext.CloudConfig.ProjectID, region, zone, managedZones, "" /* networkUrl */, tokenSource, false /* useMetadataServer */) if err != nil { <del> glog.Fatal("Error building GCE provider: ", err) </del> <ins> return fmt.Errorf("Error building GCE/GKE provider: ", err) </ins> } <del> } if testContext.Provider == "aws" { </del> <ins> case "aws": </ins> awsConfig := "[Global]n" if cloudConfig.Zone == "" { <del> glog.Fatal("gce-zone must be specified for AWS") </del> <ins> return fmt.Errorf("gce-zone must be specified for AWS") </ins> } awsConfig += fmt.Sprintf("Zone=%sn", cloudConfig.Zone) if cloudConfig.ClusterTag == "" { <del> glog.Fatal("--cluster-tag must be specified for AWS") </del> <ins> return fmt.Errorf("--cluster-tag must be specified for AWS") </ins> } awsConfig += fmt.Sprintf("KubernetesClusterTag=%sn", cloudConfig.ClusterTag) var err error cloudConfig.Provider, err = cloudprovider.GetCloudProvider(testContext.Provider, strings.NewReader(awsConfig)) if err != nil { <del> glog.Fatal("Error building AWS provider: ", err) </del> <ins> return fmt.Errorf("Error building AWS provider: ", err) </ins> } <del> } // Disable skipped tests unless they are explicitly requested. if config.GinkgoConfig.FocusString == "" && config.GinkgoConfig.SkipString == "" { // TODO(ihmccreery) Remove [Skipped] once all [Skipped] labels have been reclassified. config.GinkgoConfig.SkipString = `[Flaky]|[Skipped]|[Feature:.+]` </del> } <del> gomega.RegisterFailHandler(ginkgo.Fail) c, err := loadClient() if err != nil { glog.Fatal("Error loading client: ", err) } </del> <ins> return nil } // There are certain operations we only want to run once per overall test invocation // (such as deleting old namespaces, or verifying that all system pods are running. // Because of the way Ginkgo runs tests in parallel, we must use SynchronizedBeforeSuite // to ensure that these operations only run on the first parallel Ginkgo node. // // This function takes two parameters: one function which runs on only the first Ginkgo node, // returning an opaque byte array, and then a second function which runs on all Ginkgo nodes, // accepting the byte array. var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { // Run only on Ginkgo node 1 </ins> // Delete any namespaces except default and kube-system. This ensures no // lingering resources are left over from a previous test run. if testContext.CleanStart { <ins> c, err := loadClient() if err != nil { glog.Fatal("Error loading client: ", err) } </ins> deleted, err := deleteNamespaces(c, nil /* deleteFilter */, []string{api.NamespaceSystem, api.NamespaceDefault}) if err != nil { <del> t.Errorf("Error deleting orphaned namespaces: %v", err) </del> <ins> Failf("Error deleting orphaned namespaces: %v", err) </ins> } glog.Infof("Waiting for deletion of the following namespaces: %v", deleted) if err := waitForNamespacesDeleted(c, deleted, namespaceCleanupTimeout); err != nil { <del> glog.Fatalf("Failed to delete orphaned namespaces %v: %v", deleted, err) </del> <ins> Failf("Failed to delete orphaned namespaces %v: %v", deleted, err) </ins> } }