mirror of https://github.com/k3s-io/k3s
E2E upgrade test: allow upgrade target version to be specified via command line.
parent
ffc5a86098
commit
7cfabea2d3
|
@ -42,12 +42,12 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// version applies to upgrades; kube-push always pushes local binaries.
|
// version applies to upgrades; kube-push always pushes local binaries.
|
||||||
version = "latest_ci"
|
|
||||||
versionURLFmt = "https://storage.googleapis.com/kubernetes-release/%s/%s.txt"
|
versionURLFmt = "https://storage.googleapis.com/kubernetes-release/%s/%s.txt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// realVersion turns a version constant--one accepted by cluster/gce/upgrade.sh--
|
// realVersion turns a version constant s--one accepted by cluster/gce/upgrade.sh--
|
||||||
// into a deployable version string.
|
// 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.
|
// NOTE: KEEP THIS LIST UP-TO-DATE WITH THE CODE BELOW.
|
||||||
// The version strings supported are:
|
// The version strings supported are:
|
||||||
|
@ -65,7 +65,10 @@ func realVersion(s string) (string, error) {
|
||||||
case "latest_ci":
|
case "latest_ci":
|
||||||
bucket, file = "ci", "latest"
|
bucket, file = "ci", "latest"
|
||||||
default:
|
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)
|
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 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
|
// the master and nodes won't be skewed if the value changes during the
|
||||||
// test.
|
// test.
|
||||||
By(fmt.Sprintf("Getting real version for %q", version))
|
By(fmt.Sprintf("Getting real version for %q", testContext.UpgradeTarget))
|
||||||
var err error
|
var err error
|
||||||
v, err = realVersion(version)
|
v, err = realVersion(testContext.UpgradeTarget)
|
||||||
expectNoError(err)
|
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")
|
By("Setting up the service, RC, and pods")
|
||||||
f.beforeEach()
|
f.beforeEach()
|
||||||
|
|
|
@ -79,7 +79,7 @@ func init() {
|
||||||
|
|
||||||
flag.StringVar(&cloudConfig.ClusterTag, "cluster-tag", "", "Tag used to identify resources. Only required if provider is aws.")
|
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.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) {
|
func TestE2E(t *testing.T) {
|
||||||
|
|
|
@ -113,6 +113,7 @@ type TestContextType struct {
|
||||||
OutputDir string
|
OutputDir string
|
||||||
prefix string
|
prefix string
|
||||||
MinStartupPods int
|
MinStartupPods int
|
||||||
|
UpgradeTarget string
|
||||||
}
|
}
|
||||||
|
|
||||||
var testContext TestContextType
|
var testContext TestContextType
|
||||||
|
|
Loading…
Reference in New Issue