mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
Allow disabling waiting for a service account in e2e tests
This commit is contained in:
parent
0902f80f8b
commit
96a90f45c3
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user