From df765edb64162b58b8250d0452e2ca10e1fd6d9a Mon Sep 17 00:00:00 2001 From: Artiom Diomin Date: Sat, 3 Apr 2021 18:34:41 +0300 Subject: [PATCH 1/4] Remove e2e build tag Along with testing.Init() call hack Signed-off-by: Artiom Diomin --- hack/run-ci-e2e-test.sh | 4 ++-- test/e2e/conformance_test.go | 8 ++++++-- test/e2e/main_test.go | 11 ----------- test/e2e/upgrade_test.go | 8 ++++++-- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/hack/run-ci-e2e-test.sh b/hack/run-ci-e2e-test.sh index 66c49185e..faa3c48c0 100755 --- a/hack/run-ci-e2e-test.sh +++ b/hack/run-ci-e2e-test.sh @@ -149,11 +149,11 @@ function runE2E() { set -x go test \ - -tags=e2e \ + ./test/e2e \ -v \ -timeout="${timeout}" \ -run="${test_set}" \ - ./test/e2e \ + -args \ -credentials="${CREDENTIALS_FILE_PATH}" \ -identifier="${BUILD_ID}" \ -provider="${PROVIDER}" \ diff --git a/test/e2e/conformance_test.go b/test/e2e/conformance_test.go index f783d4924..99f8f2681 100644 --- a/test/e2e/conformance_test.go +++ b/test/e2e/conformance_test.go @@ -1,5 +1,3 @@ -// +build e2e - /* Copyright 2019 The KubeOne Authors. @@ -20,6 +18,7 @@ package e2e import ( "fmt" + "os" "testing" "time" @@ -99,6 +98,11 @@ func TestClusterConformance(t *testing.T) { //nolint:gocyclo // to satisfy scope linter tc := tc t.Run(tc.name, func(t *testing.T) { + _, runThisTest := os.LookupEnv("TEST_SET") + if !runThisTest { + t.Skip("set TEST_SET to run this test") + } + // Only run selected test suite. // Test options are controlled using flags. if testProvider != tc.provider { diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index 5ef05bb40..d0ca1a74d 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -1,5 +1,3 @@ -// +build e2e - /* Copyright 2019 The KubeOne Authors. @@ -56,17 +54,8 @@ func init() { flag.StringVar(&testTargetVersion, "target-version", "", "Cluster version to provision for tests") flag.StringVar(&testOSControlPlane, "os-control-plane", "", "Operating system to use for control plane nodes") flag.StringVar(&testOSWorkers, "os-workers", "", "Operating system to use for worker nodes") - flag.Parse() } -// This is a workaround for a change in the testing framework -// affecting Go 1.13 and newer. -// More details: https://github.com/golang/go/issues/31859#issuecomment-489889428 -var _ = func() bool { - testing.Init() - return true -}() - func setupTearDown(p provisioner.Provisioner, k *Kubeone) func(t *testing.T) { return func(t *testing.T) { t.Log("cleanup ....") diff --git a/test/e2e/upgrade_test.go b/test/e2e/upgrade_test.go index 52665c4a4..72dcf04ff 100644 --- a/test/e2e/upgrade_test.go +++ b/test/e2e/upgrade_test.go @@ -1,5 +1,3 @@ -// +build e2e - /* Copyright 2019 The KubeOne Authors. @@ -21,6 +19,7 @@ package e2e import ( "context" "fmt" + "os" "testing" "time" @@ -105,6 +104,11 @@ func TestClusterUpgrade(t *testing.T) { // to satisfy scope linter tc := tc t.Run(tc.name, func(t *testing.T) { + _, runThisTest := os.LookupEnv("TEST_SET") + if !runThisTest { + t.Skip("set TEST_SET to run this test") + } + // Only run selected test suite. // Test options are controlled using flags. if len(testRunIdentifier) == 0 { From 7424a09222efda7e2c7c90370c43d315e26182f2 Mon Sep 17 00:00:00 2001 From: Artiom Diomin Date: Mon, 5 Apr 2021 18:06:12 +0300 Subject: [PATCH 2/4] Use KUBEONE_TEST_RUN to indicate actual E2E test to run Signed-off-by: Artiom Diomin --- .prow.yaml | 208 +++++++++++++++++++++-------------- hack/run-ci-e2e-test.sh | 55 +++++---- test/e2e/conformance_test.go | 4 +- test/e2e/upgrade_test.go | 4 +- 4 files changed, 154 insertions(+), 117 deletions(-) diff --git a/.prow.yaml b/.prow.yaml index 406c3198a..0aa13b3c5 100644 --- a/.prow.yaml +++ b/.prow.yaml @@ -147,8 +147,8 @@ presubmits: value: containerd - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -173,8 +173,8 @@ presubmits: value: "aws" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -199,12 +199,12 @@ presubmits: value: "aws" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 - + - name: pull-kubeone-e2e-aws-conformance-1.20 run_if_changed: "(pkg/|examples/terraform/aws|hack/|test/)" decorate: true @@ -225,8 +225,8 @@ presubmits: value: "aws" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -255,8 +255,8 @@ presubmits: value: "digitalocean" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -281,8 +281,8 @@ presubmits: value: "digitalocean" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -307,8 +307,8 @@ presubmits: value: "digitalocean" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -337,8 +337,8 @@ presubmits: value: "hetzner" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -363,8 +363,8 @@ presubmits: value: "hetzner" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -389,8 +389,8 @@ presubmits: value: "hetzner" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -419,8 +419,8 @@ presubmits: value: "gce" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" - name: TF_VAR_project value: "kubeone-terraform-test" resources: @@ -447,8 +447,8 @@ presubmits: value: "gce" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" - name: TF_VAR_project value: "kubeone-terraform-test" resources: @@ -475,8 +475,8 @@ presubmits: value: "gce" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" - name: TF_VAR_project value: "kubeone-terraform-test" resources: @@ -507,8 +507,8 @@ presubmits: value: "packet" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -533,12 +533,12 @@ presubmits: value: "packet" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 - + - name: pull-kubeone-e2e-packet-conformance-1.20 always_run: false decorate: true @@ -559,8 +559,8 @@ presubmits: value: "packet" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -589,8 +589,8 @@ presubmits: value: "openstack" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -615,12 +615,12 @@ presubmits: value: "openstack" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 - + - name: pull-kubeone-e2e-openstack-conformance-1.20 always_run: false decorate: true @@ -641,8 +641,8 @@ presubmits: value: "openstack" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "conformance" + - name: KUBEONE_TEST_RUN + value: "TestClusterConformance" resources: requests: cpu: 1 @@ -675,8 +675,10 @@ presubmits: value: "1.17.17" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" - name: pull-kubeone-e2e-aws-upgrade-1.17-1.18 run_if_changed: "(pkg/|examples/terraform/aws|hack/|test/)" @@ -700,8 +702,10 @@ presubmits: value: "1.17.17" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" - name: pull-kubeone-e2e-aws-upgrade-1.18-1.19 run_if_changed: "(pkg/|examples/terraform/aws|hack/|test/)" @@ -725,9 +729,11 @@ presubmits: value: "1.18.15" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "upgrades" - + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" + - name: pull-kubeone-e2e-aws-upgrade-1.19-1.20 run_if_changed: "(pkg/|examples/terraform/aws|hack/|test/)" decorate: true @@ -750,8 +756,10 @@ presubmits: value: "1.19.7" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" ######################################################### # E2E/Upgrade tests (DigitalOcean) @@ -779,8 +787,10 @@ presubmits: value: "1.17.17" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" - name: pull-kubeone-e2e-digitalocean-upgrade-1.18-1.19 always_run: false @@ -804,9 +814,11 @@ presubmits: value: "1.18.15" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "upgrades" - + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" + - name: pull-kubeone-e2e-digitalocean-upgrade-1.19-1.20 always_run: false decorate: true @@ -829,8 +841,10 @@ presubmits: value: "1.19.7" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" ######################################################### # E2E/Upgrade tests (Hetzner) @@ -858,8 +872,10 @@ presubmits: value: "1.17.17" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" - name: pull-kubeone-e2e-hetzner-upgrade-1.18-1.19 always_run: false @@ -883,9 +899,11 @@ presubmits: value: "1.18.15" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "upgrades" - + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" + - name: pull-kubeone-e2e-hetzner-upgrade-1.19-1.20 always_run: false decorate: true @@ -908,8 +926,10 @@ presubmits: value: "1.19.7" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" ######################################################### # E2E/Upgrade tests (GCE) @@ -937,8 +957,10 @@ presubmits: value: "1.17.17" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" - name: TF_VAR_project value: "kubeone-terraform-test" @@ -964,11 +986,13 @@ presubmits: value: "1.18.15" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" - name: TF_VAR_project value: "kubeone-terraform-test" - + - name: pull-kubeone-e2e-gce-upgrade-1.19-1.20 always_run: false decorate: true @@ -991,8 +1015,10 @@ presubmits: value: "1.19.7" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" - name: TF_VAR_project value: "kubeone-terraform-test" @@ -1022,8 +1048,10 @@ presubmits: value: "1.17.17" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" - name: pull-kubeone-e2e-packet-upgrade-1.18-1.19 always_run: false @@ -1047,9 +1075,11 @@ presubmits: value: "1.18.15" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "upgrades" - + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" + - name: pull-kubeone-e2e-packet-upgrade-1.19-1.20 always_run: false decorate: true @@ -1072,8 +1102,10 @@ presubmits: value: "1.19.7" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" ######################################################### # E2E/Upgrade tests (OpenStack) @@ -1101,8 +1133,10 @@ presubmits: value: "1.17.17" - name: TEST_CLUSTER_TARGET_VERSION value: "1.18.15" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" - name: pull-kubeone-e2e-openstack-upgrade-1.18-1.19 always_run: false @@ -1126,9 +1160,11 @@ presubmits: value: "1.18.15" - name: TEST_CLUSTER_TARGET_VERSION value: "1.19.7" - - name: TEST_SET - value: "upgrades" - + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" + - name: pull-kubeone-e2e-openstack-upgrade-1.19-1.20 always_run: false decorate: true @@ -1151,8 +1187,10 @@ presubmits: value: "1.19.7" - name: TEST_CLUSTER_TARGET_VERSION value: "1.20.2" - - name: TEST_SET - value: "upgrades" + - name: TEST_TIMEOUT + valut: "120m" + - name: KUBEONE_TEST_RUN + value: "TestClusterUpgrade" postsubmits: - name: ci-push-kubeone-e2e-image diff --git a/hack/run-ci-e2e-test.sh b/hack/run-ci-e2e-test.sh index faa3c48c0..db0cacc8a 100755 --- a/hack/run-ci-e2e-test.sh +++ b/hack/run-ci-e2e-test.sh @@ -24,14 +24,15 @@ set -o pipefail RUNNING_IN_CI=${JOB_NAME:-""} BUILD_ID=${BUILD_ID:-"${USER}-local"} -PROVIDER=${PROVIDER:-"aws"} -CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-"docker"} +PROVIDER=${PROVIDER:-"PROVIDER-MISSING"} +CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-} KUBETESTS_ROOT=$(realpath "${KUBETESTS_ROOT:-"/opt/kube-test"}") -TEST_SET=${TEST_SET:-"conformance"} -TEST_CLUSTER_TARGET_VERSION=${TEST_CLUSTER_TARGET_VERSION:-""} -TEST_CLUSTER_INITIAL_VERSION=${TEST_CLUSTER_INITIAL_VERSION:-""} -TEST_OS_CONTROL_PLANE=${TEST_OS_CONTROL_PLANE:-""} -TEST_OS_WORKERS=${TEST_OS_WORKERS:-""} +KUBEONE_TEST_RUN=${KUBEONE_TEST_RUN:-} +TEST_CLUSTER_TARGET_VERSION=${TEST_CLUSTER_TARGET_VERSION:-} +TEST_CLUSTER_INITIAL_VERSION=${TEST_CLUSTER_INITIAL_VERSION:-} +TEST_OS_CONTROL_PLANE=${TEST_OS_CONTROL_PLANE:-} +TEST_OS_WORKERS=${TEST_OS_WORKERS:-} +TEST_TIMEOUT="60m" PATH=$PATH:$(go env GOPATH)/bin TERRAFORM_DIR=$PWD/examples/terraform SSH_PRIVATE_KEY_FILE="${HOME}/.ssh/id_rsa_kubeone_e2e" @@ -44,7 +45,7 @@ CREDENTIALS_FILE_PATH="" function cleanup() { set +e - for try in {1..20}; do + for try in {1..3}; do cd "${TERRAFORM_DIR}/${PROVIDER}" echo "Cleaning up terraform state, attempt ${try}" # Upstream interpolation bug, but we dont care about the output @@ -144,15 +145,26 @@ function ssh_agent() { } function runE2E() { - local test_set=$1 - local timeout=$2 + local run_filter=$1 set -x + # split run_filter by / in case if filter contain nested subtests. + # nested subtests are valid for `go test -run`, but will not be reflected by `go test -list`. + local list_filter + IFS='/' read -ra list_filter <<< "${run_filter}" + + numberOfTestsToRun=$(go test ./test/e2e -list "${list_filter[0]}" | wc -l) + numberOfTestsToRun=$(( "$numberOfTestsToRun"-1 )) + + if [[ "$numberOfTestsToRun" == "0" ]]; then + fail "run_filter '${run_filter}' selects no tests to run" + fi + go test \ ./test/e2e \ -v \ - -timeout="${timeout}" \ - -run="${test_set}" \ + -timeout="${TEST_TIMEOUT}" \ + -run="${run_filter}" \ -args \ -credentials="${CREDENTIALS_FILE_PATH}" \ -identifier="${BUILD_ID}" \ @@ -167,21 +179,8 @@ function runE2E() { if [ -n "${RUNNING_IN_CI}" ]; then setup_ci_environment_vars link_s3_backend + generate_ssh_key "${SSH_PRIVATE_KEY_FILE}" + ssh_agent "${SSH_PRIVATE_KEY_FILE}" fi -generate_ssh_key "${SSH_PRIVATE_KEY_FILE}" -ssh_agent "${SSH_PRIVATE_KEY_FILE}" - -# Start the tests -echo "Running E2E tests ..." -case ${TEST_SET} in -"conformance") - runE2E "TestClusterConformance" "60m" - ;; -"upgrades") - runE2E "TestClusterUpgrade" "120m" - ;; -*) - fail "unknown TEST_SET: ${TEST_SET}" - ;; -esac +runE2E "${KUBEONE_TEST_RUN}" diff --git a/test/e2e/conformance_test.go b/test/e2e/conformance_test.go index 99f8f2681..49ad94bb1 100644 --- a/test/e2e/conformance_test.go +++ b/test/e2e/conformance_test.go @@ -98,9 +98,9 @@ func TestClusterConformance(t *testing.T) { //nolint:gocyclo // to satisfy scope linter tc := tc t.Run(tc.name, func(t *testing.T) { - _, runThisTest := os.LookupEnv("TEST_SET") + _, runThisTest := os.LookupEnv("KUBEONE_TEST_SET") if !runThisTest { - t.Skip("set TEST_SET to run this test") + t.Skip("set KUBEONE_TEST_SET to run this test") } // Only run selected test suite. diff --git a/test/e2e/upgrade_test.go b/test/e2e/upgrade_test.go index 72dcf04ff..4fb0c6854 100644 --- a/test/e2e/upgrade_test.go +++ b/test/e2e/upgrade_test.go @@ -104,9 +104,9 @@ func TestClusterUpgrade(t *testing.T) { // to satisfy scope linter tc := tc t.Run(tc.name, func(t *testing.T) { - _, runThisTest := os.LookupEnv("TEST_SET") + _, runThisTest := os.LookupEnv("KUBEONE_TEST_SET") if !runThisTest { - t.Skip("set TEST_SET to run this test") + t.Skip("set KUBEONE_TEST_SET to run this test") } // Only run selected test suite. From 8ceb17a0819550646b79aefa0beec4975cd7ef76 Mon Sep 17 00:00:00 2001 From: Artiom Diomin Date: Mon, 5 Apr 2021 18:26:05 +0300 Subject: [PATCH 3/4] Centralize checking env Signed-off-by: Artiom Diomin --- test/e2e/conformance_test.go | 6 +----- test/e2e/main_test.go | 8 ++++++++ test/e2e/upgrade_test.go | 6 +----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/e2e/conformance_test.go b/test/e2e/conformance_test.go index 49ad94bb1..dfbbbd44b 100644 --- a/test/e2e/conformance_test.go +++ b/test/e2e/conformance_test.go @@ -18,7 +18,6 @@ package e2e import ( "fmt" - "os" "testing" "time" @@ -98,10 +97,7 @@ func TestClusterConformance(t *testing.T) { //nolint:gocyclo // to satisfy scope linter tc := tc t.Run(tc.name, func(t *testing.T) { - _, runThisTest := os.LookupEnv("KUBEONE_TEST_SET") - if !runThisTest { - t.Skip("set KUBEONE_TEST_SET to run this test") - } + checkEnv(t) // Only run selected test suite. // Test options are controlled using flags. diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index d0ca1a74d..219d533da 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -19,6 +19,7 @@ package e2e import ( "context" "flag" + "os" "strings" "testing" "time" @@ -56,6 +57,13 @@ func init() { flag.StringVar(&testOSWorkers, "os-workers", "", "Operating system to use for worker nodes") } +func checkEnv(t *testing.T) { + _, runThisTest := os.LookupEnv("KUBEONE_TEST_RUN") + if !runThisTest { + t.Skip("set KUBEONE_TEST_RUN to run this test") + } +} + func setupTearDown(p provisioner.Provisioner, k *Kubeone) func(t *testing.T) { return func(t *testing.T) { t.Log("cleanup ....") diff --git a/test/e2e/upgrade_test.go b/test/e2e/upgrade_test.go index 4fb0c6854..d05205af5 100644 --- a/test/e2e/upgrade_test.go +++ b/test/e2e/upgrade_test.go @@ -19,7 +19,6 @@ package e2e import ( "context" "fmt" - "os" "testing" "time" @@ -104,10 +103,7 @@ func TestClusterUpgrade(t *testing.T) { // to satisfy scope linter tc := tc t.Run(tc.name, func(t *testing.T) { - _, runThisTest := os.LookupEnv("KUBEONE_TEST_SET") - if !runThisTest { - t.Skip("set KUBEONE_TEST_SET to run this test") - } + checkEnv(t) // Only run selected test suite. // Test options are controlled using flags. From e408ce3c14f0b13af5e8430f66bc3cb78ae0c7e2 Mon Sep 17 00:00:00 2001 From: Artiom Diomin Date: Mon, 5 Apr 2021 22:28:33 +0300 Subject: [PATCH 4/4] Add missing default to $TEST_TIMEOUT Signed-off-by: Artiom Diomin --- hack/run-ci-e2e-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/run-ci-e2e-test.sh b/hack/run-ci-e2e-test.sh index db0cacc8a..7573e79e9 100755 --- a/hack/run-ci-e2e-test.sh +++ b/hack/run-ci-e2e-test.sh @@ -32,7 +32,7 @@ TEST_CLUSTER_TARGET_VERSION=${TEST_CLUSTER_TARGET_VERSION:-} TEST_CLUSTER_INITIAL_VERSION=${TEST_CLUSTER_INITIAL_VERSION:-} TEST_OS_CONTROL_PLANE=${TEST_OS_CONTROL_PLANE:-} TEST_OS_WORKERS=${TEST_OS_WORKERS:-} -TEST_TIMEOUT="60m" +TEST_TIMEOUT=${TEST_TIMEOUT:-"60m"} PATH=$PATH:$(go env GOPATH)/bin TERRAFORM_DIR=$PWD/examples/terraform SSH_PRIVATE_KEY_FILE="${HOME}/.ssh/id_rsa_kubeone_e2e"