From 7b5e65977cd56472510a74155631c8980d3ffdc7 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 31 Jan 2019 15:54:48 +0100 Subject: [PATCH] e2e: "skeleton" as fallback, empty string as default Not accepting --provider= (i.e. setting an empty provider name) broke some test jobs. As suggested in https://github.com/kubernetes/kubernetes/pull/73402#issuecomment-459368230, now --provider= and not passing --provider at all both trigger a message and then continue as if --provider=skeleton had been used. --- test/e2e/framework/test_context.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index f1bd4d839f..d8f6e15658 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -266,7 +266,7 @@ func RegisterClusterFlags() { flag.StringVar(&TestContext.KubeVolumeDir, "volume-dir", "/var/lib/kubelet", "Path to the directory containing the kubelet volumes.") flag.StringVar(&TestContext.CertDir, "cert-dir", "", "Path to the directory containing the certs. Default is empty, which doesn't use certs.") flag.StringVar(&TestContext.RepoRoot, "repo-root", "../../", "Root directory of kubernetes repository, for finding test files.") - flag.StringVar(&TestContext.Provider, "provider", "skeleton", "The name of the Kubernetes provider (gce, gke, local, skeleton (the default), etc.)") + flag.StringVar(&TestContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, skeleton (the fallback if not set), etc.)") flag.StringVar(&TestContext.Tooling, "tooling", "", "The tooling in use (kops, gke, etc.)") flag.StringVar(&TestContext.KubectlPath, "kubectl-path", "kubectl", "The kubectl binary to use. For development, you might use 'cluster/kubectl.sh' here.") flag.StringVar(&TestContext.OutputDir, "e2e-output-dir", "/tmp", "Output directory for interesting/useful test data, like performance data, benchmarks, and other metrics.") @@ -403,6 +403,13 @@ func AfterReadingAllFlags(t *TestContextType) { // Make sure that all test runs have a valid TestContext.CloudConfig.Provider. // TODO: whether and how long this code is needed is getting discussed // in https://github.com/kubernetes/kubernetes/issues/70194. + if TestContext.Provider == "" { + // Some users of the e2e.test binary pass --provider=. + // We need to support that, changing it would break those usages. + Logf("The --provider flag is not set. Continuing as if --provider=skeleton had been used.") + TestContext.Provider = "skeleton" + } + var err error TestContext.CloudConfig.Provider, err = SetupProviderConfig(TestContext.Provider) if err != nil {