mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #13974 from gmarek/framework
Allow disabling waiting for a service account in e2e tests
This commit is contained in:
commit
a327844575
@ -65,6 +65,7 @@ dockercfg-path
|
|||||||
driver-port
|
driver-port
|
||||||
dry-run
|
dry-run
|
||||||
duration-sec
|
duration-sec
|
||||||
|
e2e-verify-service-account
|
||||||
e2e-output-dir
|
e2e-output-dir
|
||||||
enable-debugging-handlers
|
enable-debugging-handlers
|
||||||
enable-horizontal-pod-autoscaler
|
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.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.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.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) {
|
func TestE2E(t *testing.T) {
|
||||||
|
@ -67,9 +67,13 @@ func (f *Framework) beforeEach() {
|
|||||||
|
|
||||||
f.Namespace = namespace
|
f.Namespace = namespace
|
||||||
|
|
||||||
|
if testContext.VerifyServiceAccount {
|
||||||
By("Waiting for a default service account to be provisioned in namespace")
|
By("Waiting for a default service account to be provisioned in namespace")
|
||||||
err = waitForDefaultServiceAccountInNamespace(c, namespace.Name)
|
err = waitForDefaultServiceAccountInNamespace(c, namespace.Name)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
} else {
|
||||||
|
Logf("Skipping waiting for service account")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// afterEach deletes the namespace, after reading its events.
|
// afterEach deletes the namespace, after reading its events.
|
||||||
|
@ -122,6 +122,7 @@ type TestContextType struct {
|
|||||||
MinStartupPods int
|
MinStartupPods int
|
||||||
UpgradeTarget string
|
UpgradeTarget string
|
||||||
PrometheusPushGateway string
|
PrometheusPushGateway string
|
||||||
|
VerifyServiceAccount bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var testContext TestContextType
|
var testContext TestContextType
|
||||||
@ -481,9 +482,11 @@ func createTestingNS(baseName string, c *client.Client) (*api.Namespace, error)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if testContext.VerifyServiceAccount {
|
||||||
if err := waitForDefaultServiceAccountInNamespace(c, got.Name); err != nil {
|
if err := waitForDefaultServiceAccountInNamespace(c, got.Name); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return got, nil
|
return got, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user