Skip to content

Commit 371dffc

Browse files
committed
Change test skips based on environment variable
1 parent 8460868 commit 371dffc

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

Diff for: test/e2e/tests/setup_e2e_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ var (
4949
cloudtopHost = flag.Bool("cloudtop-host", false, "The local host is cloudtop, a kind of googler machine with special requirements to access GCP")
5050
extraDriverFlags = flag.String("extra-driver-flags", "", "Extra flags to pass to the driver")
5151
enableConfidentialCompute = flag.Bool("enable-confidential-compute", false, "Create VMs with confidential compute mode. This uses NVMe devices")
52-
gitTag = flag.String("git-tag", "", "The most recent tag relative to the current commit. Used to generate test skips.")
5352

5453
testContexts = []*remote.TestContext{}
5554
computeService *compute.Service

Diff for: test/e2e/tests/single_zone_e2e_test.go

+17-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package tests
1717
import (
1818
"context"
1919
"fmt"
20+
"os"
2021
"path/filepath"
2122
"regexp"
2223
"strconv"
@@ -1571,9 +1572,8 @@ var _ = Describe("GCE PD CSI Driver", func() {
15711572
updatedIops *string,
15721573
updatedThroughput *string,
15731574
) {
1574-
// ControllerModifyVolume is introduced in v1.15.0, so skip tests otherwise
1575-
if len(*gitTag) == 0 || *gitTag < "v1.15.0" {
1576-
Skip("Not running ControllerModifyVolume tests, as the current git tag is below v1.15.0.")
1575+
if !runCMVTests() {
1576+
Skip("Not running ControllerModifyVolume tests, as RUN_CONTROLLER_MODIFY_VOLUME_TESTS is falsy")
15771577
}
15781578
Expect(testContexts).ToNot(BeEmpty())
15791579
testContext := getRandomTestContext()
@@ -1896,6 +1896,20 @@ func merge(a, b map[string]string) map[string]string {
18961896
return res
18971897
}
18981898

1899+
func runCMVTests() bool {
1900+
runCMVStr, ok := os.LookupEnv("RUN_CONTROLLER_MODIFY_VOLUME_TESTS")
1901+
if !ok {
1902+
return false
1903+
}
1904+
1905+
runCMVTests, err := strconv.ParseBool(runCMVStr)
1906+
if err != nil {
1907+
return false
1908+
}
1909+
1910+
return runCMVTests
1911+
}
1912+
18991913
func stringPtr(str string) *string {
19001914
return &str
19011915
}

Diff for: test/run-e2e-local.sh

+1-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,4 @@ if hostname | grep -q c.googlers.com ; then
1616
CLOUDTOP_HOST=--cloudtop-host
1717
fi
1818

19-
GIT_TAG=
20-
if $(command -v git > /dev/null); then
21-
# Get the most recent tag version relative to the current state
22-
GIT_TAG=$(git describe --abbrev=0 --tags)
23-
fi
24-
25-
ginkgo --v "test/e2e/tests" -- --project "${PROJECT}" --service-account "${IAM_NAME}" "${CLOUDTOP_HOST}" --git-tag "${GIT_TAG}" --v=6 --logtostderr $@
19+
ginkgo --v "test/e2e/tests" -- --project "${PROJECT}" --service-account "${IAM_NAME}" "${CLOUDTOP_HOST}" --v=6 --logtostderr $@

Diff for: test/run-e2e.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ set -x
55

66
readonly PKGDIR=sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
77

8-
go test --timeout 45m --v "${PKGDIR}/test/e2e/tests" --run-in-prow=true --delete-instances=true --logtostderr $@
8+
TIMEOUT=30m
9+
if [ "$RUN_CONTROLLER_MODIFY_VOLUME_TESTS" = true ]; then
10+
TIMEOUT=45m
11+
fi
12+
13+
go test --timeout "${TIMEOUT}" --v "${PKGDIR}/test/e2e/tests" --run-in-prow=true --delete-instances=true --logtostderr $@

0 commit comments

Comments
 (0)