From 899cf360bad0d9575124a46da455e048b6dfbeb1 Mon Sep 17 00:00:00 2001 From: Sami Wagiaalla Date: Fri, 5 Jun 2015 16:43:43 -0400 Subject: [PATCH] Add a prefix option to e2e for use with resources This is helpful when cleaning manually up after a failed test in shared a gce environment. Signed-off-by: Sami Wagiaalla --- hack/ginkgo-e2e.sh | 1 + test/e2e/e2e_test.go | 1 + test/e2e/pd.go | 2 +- test/e2e/util.go | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hack/ginkgo-e2e.sh b/hack/ginkgo-e2e.sh index 3437873425b..a9821cc152c 100755 --- a/hack/ginkgo-e2e.sh +++ b/hack/ginkgo-e2e.sh @@ -105,5 +105,6 @@ export PATH=$(dirname "${e2e_test}"):"${PATH}" --repo-root="${KUBE_VERSION_ROOT}" \ --node-instance-group="${NODE_INSTANCE_GROUP:-}" \ --num-nodes="${NUM_MINIONS:-}" \ + --prefix="${KUBE_GCE_INSTANCE_PREFIX:-e2e}" \ ${E2E_REPORT_DIR+"--report-dir=${E2E_REPORT_DIR}"} \ "${@:-}" diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index bcf78a5371f..993234872ee 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -101,6 +101,7 @@ func init() { flag.StringVar(&testContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, vagrant, 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.") + flag.StringVar(&testContext.prefix, "prefix", "e2e", "A prefix to be added to cloud resources created during testing.") // TODO: Flags per provider? Rename gce-project/gce-zone? flag.StringVar(&cloudConfig.MasterName, "kube-master", "", "Name of the kubernetes master. Only required if provider is gce or gke") diff --git a/test/e2e/pd.go b/test/e2e/pd.go index b0502be979b..071d7b11f3f 100644 --- a/test/e2e/pd.go +++ b/test/e2e/pd.go @@ -189,7 +189,7 @@ var _ = Describe("Pod Disks", func() { func createPD() (string, error) { if testContext.Provider == "gce" { - pdName := fmt.Sprintf("e2e-%s", string(util.NewUUID())) + pdName := fmt.Sprintf("%s-%s", testContext.prefix, string(util.NewUUID())) zone := testContext.CloudConfig.Zone // TODO: make this hit the compute API directly instread of shelling out to gcloud. diff --git a/test/e2e/util.go b/test/e2e/util.go index 2d41c2c2ca1..489fea49e19 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -93,6 +93,7 @@ type TestContextType struct { CloudConfig CloudConfig KubectlPath string OutputDir string + prefix string } var testContext TestContextType