From 1c9da19bf5b6bc2c6f640e86c08b667204094f64 Mon Sep 17 00:00:00 2001 From: Howard Zhang Date: Mon, 2 Sep 2019 16:03:55 +0800 Subject: [PATCH] Add kubectlPath flag to e2e_node.test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit e2e_node.test does not set default kubectlPath, which lead to test errors as following: [Fail] [sig-storage] EmptyDir volumes [It] pod should support shared volumes between containers [Conformance] When the test trying to read file in shared volume, it uses "kubeclt exec namespace -c container_name -- cat file_name". However, as variable framework.TestContext.KubectlPath not set, kubectl binary can not be found in the test and the tast fails. This patch move kubectlPath flag from RegisterClusterFlags to RegisterCommonFlags, thus default value for framework.TestContext.KubectlPath will be set,and user can also use --kubectl-path flag to set kubectl path. Signed-off-by: Howard Zhang --- test/e2e/framework/test_context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index 7757635968f..da3db60d196 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -285,6 +285,7 @@ func RegisterCommonFlags(flags *flag.FlagSet) { flags.StringVar(&TestContext.KubernetesAnywherePath, "kubernetes-anywhere-path", "/workspace/k8s.io/kubernetes-anywhere", "Which directory kubernetes-anywhere is installed to.") flags.BoolVar(&TestContext.ListImages, "list-images", false, "If true, will show list of images used for runnning tests.") + flags.StringVar(&TestContext.KubectlPath, "kubectl-path", "kubectl", "The kubectl binary to use. For development, you might use 'cluster/kubectl.sh' here.") } // RegisterClusterFlags registers flags specific to the cluster e2e test suite. @@ -299,7 +300,6 @@ func RegisterClusterFlags(flags *flag.FlagSet) { flags.StringVar(&TestContext.RepoRoot, "repo-root", "../../", "Root directory of kubernetes repository, for finding test files.") flags.StringVar(&TestContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, skeleton (the fallback if not set), etc.)") flags.StringVar(&TestContext.Tooling, "tooling", "", "The tooling in use (kops, gke, etc.)") - flags.StringVar(&TestContext.KubectlPath, "kubectl-path", "kubectl", "The kubectl binary to use. For development, you might use 'cluster/kubectl.sh' here.") flags.StringVar(&TestContext.OutputDir, "e2e-output-dir", "/tmp", "Output directory for interesting/useful test data, like performance data, benchmarks, and other metrics.") flags.StringVar(&TestContext.Prefix, "prefix", "e2e", "A prefix to be added to cloud resources created during testing.") flags.StringVar(&TestContext.MasterOSDistro, "master-os-distro", "debian", "The OS distribution of cluster master (debian, ubuntu, gci, coreos, or custom).")