Skip to content

Commit e52b7e8

Browse files
committed
wip: run images and snapshots in integration tests
1 parent 598af14 commit e52b7e8

6 files changed

+29
-14
lines changed

test/k8s-integration/main.go

+20-5
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ var (
5757
// Test infrastructure flags
5858
boskosResourceType = flag.String("boskos-resource-type", "gce-project", "name of the boskos resource type to reserve")
5959
storageClassFiles = flag.String("storageclass-files", "", "name of storageclass yaml file to use for test relative to test/k8s-integration/config. This may be a comma-separated list to test multiple storage classes")
60-
snapshotClassFile = flag.String("snapshotclass-file", "", "name of snapshotclass yaml file to use for test relative to test/k8s-integration/config")
60+
snapshotClassFiles = flag.String("snapshotclass-files", "", "name of snapshotclass yaml file to use for test relative to test/k8s-integration/config. This may be a comma-separated list to test multiple storage classes")
6161
inProw = flag.Bool("run-in-prow", false, "is the test running in PROW")
6262

6363
// Driver flags
@@ -203,7 +203,6 @@ func handle() error {
203203
testParams := &testParameters{
204204
platform: *platform,
205205
testFocus: *testFocus,
206-
snapshotClassFile: *snapshotClassFile,
207206
stagingVersion: string(uuid.NewUUID()),
208207
deploymentStrategy: *deploymentStrat,
209208
useGKEManagedDriver: *useGKEManagedDriver,
@@ -481,6 +480,7 @@ func handle() error {
481480
// Run the tests using the k8sSourceDir kubernetes
482481
if len(*storageClassFiles) != 0 {
483482
applicableStorageClassFiles := []string{}
483+
applicableSnapshotClassFiles := []string{}
484484
for _, rawScFile := range strings.Split(*storageClassFiles, ",") {
485485
scFile := strings.TrimSpace(rawScFile)
486486
if len(scFile) == 0 {
@@ -495,13 +495,28 @@ func handle() error {
495495
if len(applicableStorageClassFiles) == 0 {
496496
return fmt.Errorf("No applicable storage classes found")
497497
}
498+
for _, rawSnapshotClassFile := range strings.Split(*snapshotClassFiles, ",") {
499+
snapshotClassFile := strings.TrimSpace(rawSnapshotClassFile)
500+
if len(snapshotClassFile) != 0 {
501+
applicableSnapshotClassFiles = append(applicableStorageClassFiles, snapshotClassFile)
502+
}
503+
}
504+
if len(applicableSnapshotClassFiles) == 0 {
505+
applicableSnapshotClassFiles = append(applicableStorageClassFiles, "")
506+
}
498507
var ginkgoErrors []string
499508
var testOutputDirs []string
500509
for _, scFile := range applicableStorageClassFiles {
501510
outputDir := strings.TrimSuffix(scFile, ".yaml")
502-
testOutputDirs = append(testOutputDirs, outputDir)
503-
if err = runCSITests(testParams, scFile, outputDir); err != nil {
504-
ginkgoErrors = append(ginkgoErrors, err.Error())
511+
for _, snapshotClassFile := range applicableSnapshotClassFiles {
512+
if len(snapshotClassFile) != 0 {
513+
outputDir = fmt.Sprintf("%s--%s", outputDir, strings.TrimSuffix(snapshotClassFile, ".yaml"))
514+
}
515+
testOutputDirs = append(testOutputDirs, outputDir)
516+
testParams.snapshotClassFile = snapshotClassFile
517+
if err = runCSITests(testParams, scFile, outputDir); err != nil {
518+
ginkgoErrors = append(ginkgoErrors, err.Error())
519+
}
505520
}
506521
}
507522
if err = mergeArtifacts(testOutputDirs); err != nil {

test/run-k8s-integration-ci.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ if [ -n "$gke_node_version" ]; then
102102
fi
103103

104104
if [ "$test_disk_image_snapshot" = true ]; then
105-
base_cmd="${base_cmd} --snapshotclass-file=image-volumesnapshotclass.yaml"
105+
base_cmd="${base_cmd} --snapshotclass-files=image-volumesnapshotclass.yaml,pd-volumesnapshotclass.yaml"
106106
else
107-
base_cmd="${base_cmd} --snapshotclass-file=pd-volumesnapshotclass.yaml"
107+
base_cmd="${base_cmd} --snapshotclass-files=pd-volumesnapshotclass.yaml"
108108
fi
109109

110110
eval "$base_cmd"

test/run-k8s-integration-local.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ make -C "${PKGDIR}" test-k8s-integration
5050
#${PKGDIR}/bin/k8s-integration-test --run-in-prow=false \
5151
#--staging-image=${GCE_PD_CSI_STAGING_IMAGE} --service-account-file=${GCE_PD_SA_DIR}/cloud-sa.json \
5252
#--deploy-overlay-name=prow-canary-sidecar --bringup-cluster=false --teardown-cluster=false --test-focus="External.*Storage.*snapshot" --local-k8s-dir=$KTOP \
53-
#--storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml --snapshotclass-file=pd-volumesnapshotclass.yaml --do-driver-build=true \
53+
#--storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml --snapshotclass-files=pd-volumesnapshotclass.yaml --do-driver-build=true \
5454
#--gce-zone="us-central1-b" --num-nodes=${NUM_NODES:-3}
5555

5656
# This version of the command builds and deploys the GCE PD CSI driver.
@@ -60,15 +60,15 @@ make -C "${PKGDIR}" test-k8s-integration
6060
#${PKGDIR}/bin/k8s-integration-test --run-in-prow=false \
6161
#--staging-image=${GCE_PD_CSI_STAGING_IMAGE} --service-account-file=${GCE_PD_SA_DIR}/cloud-sa.json \
6262
#--deploy-overlay-name=prow-canary-sidecar --bringup-cluster=false --teardown-cluster=false --test-focus="External.*Storage.*snapshot" --local-k8s-dir=$KTOP \
63-
#--storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml --snapshotclass-file=image-volumesnapshotclass.yaml --do-driver-build=true \
63+
#--storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml --snapshotclass-files=image-volumesnapshotclass.yaml --do-driver-build=true \
6464
#--gce-zone="us-central1-b" --num-nodes=${NUM_NODES:-3}
6565

6666
# This version of the command brings up (and subsequently tears down) a GKE
6767
# cluster with managed GCE PersistentDisk CSI driver add-on enabled, and points to
6868
# the local K8s repository to get the e2e test binary.
6969
# ${PKGDIR}/bin/k8s-integration-test --run-in-prow=false --service-account-file=${GCE_PD_SA_DIR}/cloud-sa.json \
7070
# --test-focus="External.Storage" --local-k8s-dir=$KTOP --storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml \
71-
# --snapshotclass-file=pd-volumesnapshotclass.yaml --do-driver-build=false --teardown-driver=false \
71+
# --snapshotclass-files=pd-volumesnapshotclass.yaml --do-driver-build=false --teardown-driver=false \
7272
# --gce-zone="us-central1-c" --num-nodes=${NUM_NODES:-3} --gke-cluster-version="latest" --deployment-strategy="gke" \
7373
# --use-gke-managed-driver=true --teardown-cluster=true
7474

@@ -77,7 +77,7 @@ make -C "${PKGDIR}" test-k8s-integration
7777
# the local K8s repository to get the e2e test binary.
7878
# ${PKGDIR}/bin/k8s-integration-test --run-in-prow=false --service-account-file=${GCE_PD_SA_DIR}/cloud-sa.json \
7979
# --test-focus="External.Storage" --local-k8s-dir=$KTOP --storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml \
80-
# --snapshotclass-file=pd-volumesnapshotclass.yaml --do-driver-build=false --teardown-driver=false \
80+
# --snapshotclass-files=pd-volumesnapshotclass.yaml --do-driver-build=false --teardown-driver=false \
8181
# --gce-zone="us-central1-c" --num-nodes=${NUM_NODES:-3} --gke-release-channel="rapid" --deployment-strategy="gke" \
8282
# --use-gke-managed-driver=true --teardown-cluster=true
8383

test/run-k8s-integration.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fi
4444
base_cmd="${PKGDIR}/bin/k8s-integration-test \
4545
--run-in-prow=true --service-account-file=${E2E_GOOGLE_APPLICATION_CREDENTIALS} \
4646
--do-driver-build=${do_driver_build} --teardown-driver=${teardown_driver} --boskos-resource-type=${boskos_resource_type} \
47-
--storageclass-files=sc-standard.yaml --snapshotclass-file=pd-volumesnapshotclass.yaml \
47+
--storageclass-files=sc-standard.yaml --snapshotclass-files=pd-volumesnapshotclass.yaml \
4848
--deployment-strategy=${deployment_strategy} --test-version=${test_version} \
4949
--num-nodes=3 --image-type=${image_type} --use-kubetest2=${use_kubetest2}"
5050

test/run-windows-k8s-integration.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ ${PKGDIR}/bin/k8s-integration-test \
5151
--test-version="${test_version}" \
5252
--kube-version="${kube_version}" \
5353
--storageclass-files=sc-windows.yaml \
54-
--snapshotclass-file=pd-volumesnapshotclass.yaml \
54+
--snapshotclass-files=pd-volumesnapshotclass.yaml \
5555
--test-focus='External.Storage' \
5656
--use-kubetest2="${use_kubetest2}"

test/run-windows-k8s-migration.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ ${PKGDIR}/bin/k8s-integration-test \
6060
--kube-version="${kube_version}" \
6161
--kube-feature-gates="${feature_gates}" \
6262
--storageclass-files=sc-windows.yaml \
63-
--snapshotclass-file=pd-volumesnapshotclass.yaml \
63+
--snapshotclass-files=pd-volumesnapshotclass.yaml \
6464
--test-focus="${GCE_PD_TEST_FOCUS}" \
6565
--use-kubetest2="${use_kubetest2}"

0 commit comments

Comments
 (0)