From 7cfabea2d370e6580d5065df8b3493f2f85336cf Mon Sep 17 00:00:00 2001 From: Max Forbes Date: Thu, 9 Jul 2015 11:22:28 -0700 Subject: [PATCH] E2E upgrade test: allow upgrade target version to be specified via command line. --- test/e2e/cluster_upgrade.go | 17 ++++++++++------- test/e2e/e2e_test.go | 2 +- test/e2e/util.go | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test/e2e/cluster_upgrade.go b/test/e2e/cluster_upgrade.go index 55e6c47c0ac..52877b07a8f 100644 --- a/test/e2e/cluster_upgrade.go +++ b/test/e2e/cluster_upgrade.go @@ -42,12 +42,12 @@ import ( const ( // version applies to upgrades; kube-push always pushes local binaries. - version = "latest_ci" versionURLFmt = "https://storage.googleapis.com/kubernetes-release/%s/%s.txt" ) -// realVersion turns a version constant--one accepted by cluster/gce/upgrade.sh-- -// into a deployable version string. +// realVersion turns a version constant s--one accepted by cluster/gce/upgrade.sh-- +// into a deployable version string. If the s is not known to be a version +// constant, it will assume it is already a valid version, and return s directly. // // NOTE: KEEP THIS LIST UP-TO-DATE WITH THE CODE BELOW. // The version strings supported are: @@ -65,7 +65,10 @@ func realVersion(s string) (string, error) { case "latest_ci": bucket, file = "ci", "latest" default: - return "", fmt.Errorf("version %s is not supported", s) + // If we don't match one of the above, we assume that the passed version + // is already valid (such as "0.19.1" or "0.19.1-669-gabac8c8"). + Logf("Assuming %q is already a valid version.", s) + return s, nil } url := fmt.Sprintf(versionURLFmt, bucket, file) @@ -200,11 +203,11 @@ var _ = Describe("Skipped", func() { // The version is determined once at the beginning of the test so that // the master and nodes won't be skewed if the value changes during the // test. - By(fmt.Sprintf("Getting real version for %q", version)) + By(fmt.Sprintf("Getting real version for %q", testContext.UpgradeTarget)) var err error - v, err = realVersion(version) + v, err = realVersion(testContext.UpgradeTarget) expectNoError(err) - Logf("Version for %q is %s", version, v) + Logf("Version for %q is %s", testContext.UpgradeTarget, v) By("Setting up the service, RC, and pods") f.beforeEach() diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 54a9c9751c8..507118dffee 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -79,7 +79,7 @@ func init() { flag.StringVar(&cloudConfig.ClusterTag, "cluster-tag", "", "Tag used to identify resources. Only required if provider is aws.") 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.") } func TestE2E(t *testing.T) { diff --git a/test/e2e/util.go b/test/e2e/util.go index 36813b200a4..003f7926cce 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -113,6 +113,7 @@ type TestContextType struct { OutputDir string prefix string MinStartupPods int + UpgradeTarget string } var testContext TestContextType