Allow disabling waiting for a service account in e2e tests

This commit is contained in:
gmarek 2015-09-15 12:22:12 -04:00
parent 0902f80f8b
commit 96a90f45c3
4 changed files with 14 additions and 5 deletions

View File

@ -65,6 +65,7 @@ dockercfg-path
driver-port
dry-run
duration-sec
e2e-verify-service-account
e2e-output-dir
enable-debugging-handlers
enable-horizontal-pod-autoscaler

View File

@ -81,6 +81,7 @@ func init() {
flag.IntVar(&testContext.MinStartupPods, "minStartupPods", 0, "The number of pods which we need to see in 'Running' state with a 'Ready' condition of true, before we try running tests. This is useful in any cluster which needs some base pod-based services running before it can be used.")
flag.StringVar(&testContext.UpgradeTarget, "upgrade-target", "latest_ci", "Version to upgrade to (e.g. 'latest_stable', 'latest_release', 'latest_ci', '0.19.1', '0.19.1-669-gabac8c8') if doing an upgrade test.")
flag.StringVar(&testContext.PrometheusPushGateway, "prom-push-gateway", "", "The URL to prometheus gateway, so that metrics can be pushed during e2es and scraped by prometheus. Typically something like 127.0.0.1:9091.")
flag.BoolVar(&testContext.VerifyServiceAccount, "e2e-verify-service-account", true, "If true tests will verify the service account before running.")
}
func TestE2E(t *testing.T) {

View File

@ -67,9 +67,13 @@ func (f *Framework) beforeEach() {
f.Namespace = namespace
By("Waiting for a default service account to be provisioned in namespace")
err = waitForDefaultServiceAccountInNamespace(c, namespace.Name)
Expect(err).NotTo(HaveOccurred())
if testContext.VerifyServiceAccount {
By("Waiting for a default service account to be provisioned in namespace")
err = waitForDefaultServiceAccountInNamespace(c, namespace.Name)
Expect(err).NotTo(HaveOccurred())
} else {
Logf("Skipping waiting for service account")
}
}
// afterEach deletes the namespace, after reading its events.

View File

@ -122,6 +122,7 @@ type TestContextType struct {
MinStartupPods int
UpgradeTarget string
PrometheusPushGateway string
VerifyServiceAccount bool
}
var testContext TestContextType
@ -481,8 +482,10 @@ func createTestingNS(baseName string, c *client.Client) (*api.Namespace, error)
return nil, err
}
if err := waitForDefaultServiceAccountInNamespace(c, got.Name); err != nil {
return nil, err
if testContext.VerifyServiceAccount {
if err := waitForDefaultServiceAccountInNamespace(c, got.Name); err != nil {
return nil, err
}
}
return got, nil
}