Change:
I noticed while running e2e tests locally that some tests were apparently being incorrectly skipped: I checked, and this is also true for our Jenkins runs. Currently it looks like and have this bug, though only the former actually skips the test, I think. The issue appears to be that the code inside the top-level in these files is being run before the testContext struct is filled out (and before is even called), and so testContext.Provider is empty. I'm not immediately sure what the proper fix is; I'm also worried that there might be other things broken by the fact that these blocks are called before initialization is complete. We also probably investigate if there is a better way to mark these tests as skipped; right now, there's no indication in the test report (, Jenkins test report, etc) that these tests were skipped.
I merged and which tried to disable these tests for non-{gke,gce} but apparently didn't follow-up and verify that they were still running on our platforms. /cc
Seems easy enough to fix. I'll have a PR out to fix this before Monday.

Discussion:
}) It("should have all expected certs on the master", func() { <del> if testContext.Provider != "gce" && testContext.Provider != "gke" { </del> <ins> if !providerIs("gce", "gke") { </ins> By(fmt.Sprintf("Skipping MasterCerts test for cloud provider %s (only supported for gce and gke)", testContext.Provider)) return }

// ClusterLevelLoggingWithElasticsearch is an end to end test for cluster level logging. func ClusterLevelLoggingWithElasticsearch(c *client.Client) { // TODO: For now assume we are only testing cluster logging with Elasticsearch // on GCE. Once we are sure that Elasticsearch cluster level logging // works for other providers we should widen this scope of this test. <del> if testContext.Provider != "gce" { </del> <ins> if !providerIs("gce") { </ins> Logf("Skipping cluster level logging test for provider %s", testContext.Provider) return }

Describe("guestbook", func() { var guestbookPath = filepath.Join(testContext.RepoRoot, "examples/guestbook") <del> if testContext.Provider != "gce" && testContext.Provider != "gke" { By(fmt.Sprintf("Skipping guestbook, uses createExternalLoadBalancer, a (gce|gke) feature")) } </del> It("should create and stop a working application", func() { <ins> if !providerIs("gce", "gke") { By(fmt.Sprintf("Skipping guestbook, uses createExternalLoadBalancer, a (gce|gke) feature")) return } </ins> defer cleanup(guestbookPath, frontendSelector, redisMasterSelector, redisSlaveSelector) By("creating all guestbook components")

}) It("verify monitoring pods and all cluster nodes are available on influxdb using heapster.", func() { <del> if testContext.Provider != "gce" { </del> <ins> if !providerIs("gce") { </ins> By(fmt.Sprintf("Skipping Monitoring test, which is only supported for provider gce (not %s)", testContext.Provider)) return

}) It("should schedule a pod w/ a RW PD, remove it, then schedule it on another host", func() { <del> if testContext.Provider != "gce" && testContext.Provider != "aws" { </del> <ins> if !providerIs("gce", "aws") { </ins> By(fmt.Sprintf("Skipping PD test, which is only supported for providers gce & aws (not %s)", testContext.Provider)) return

}) It("should serve a basic image on each replica with a private image", func() { <del> switch testContext.Provider { case "gce", "gke": ServeImageOrFail(c, "private", "gcr.io/_b_k8s_authenticated_test/serve_hostname:1.1") default: </del> <ins> if !providerIs("gce", "gke") { </ins> By(fmt.Sprintf("Skipping private variant, which is only supported for providers gce and gke (not %s)", testContext.Provider)) <ins> return </ins> } <ins> ServeImageOrFail(c, "private", "gcr.io/_b_k8s_authenticated_test/serve_hostname:1.1") </ins> }) })

}) It("should provide DNS for the cluster", func() { <del> if testContext.Provider == "vagrant" { </del> <ins> if providerIs("vagrant") { </ins> By("Skipping test which is broken for vagrant (See https://github.com/GoogleCloudPlatform/kubernetes/issues/3580)") return }

var _ = Describe("Shell", func() { defer GinkgoRecover() <del> // A number of scripts only work on gce if testContext.Provider != "gce" && testContext.Provider != "gke" { By(fmt.Sprintf("Skipping Shell test, which is only supported for provider gce and gke (not %s)", testContext.Provider)) return } </del> // Slurp up all the tests in hack/e2e-suite bashE2ERoot := filepath.Join(root, "hack/e2e-suite") files, err := ioutil.ReadDir(bashE2ERoot)

for _, file := range files { fileName := file.Name() // Make a copy It(fmt.Sprintf("tests that %v passes", fileName), func() { <ins> // A number of scripts only work on gce if !providerIs("gce", "gke") { By(fmt.Sprintf("Skipping Shell test %s, which is only supported for provider gce and gke (not %s)", fileName, testContext.Provider)) return } </ins> runCmdTest(filepath.Join(bashE2ERoot, fileName)) }) }

Fail(fmt.Sprintf(format, a...), 1) } <ins> func providerIs(providers ...string) bool { if testContext.Provider == "" { Fail("testContext.Provider is not defined") } for _, provider := range providers { if strings.ToLower(provider) == strings.ToLower(testContext.Provider) { return true } } return false } </ins> type podCondition func(pod *api.Pod) (bool, error) func waitForPodCondition(c *client.Client, ns, podName, desc string, condition podCondition) error {