Skip to content

Commit

Permalink
enable e2e tests to choose crd apiVersion
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Seago <sseago@redhat.com>
  • Loading branch information
sseago committed Jul 28, 2021
1 parent df65754 commit 2c46b47
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/3941-sseago
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable e2e tests to choose crd apiVersion
2 changes: 2 additions & 0 deletions test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ OUTPUT_DIR := _output/$(GOOS)/$(GOARCH)/bin
GINKGO_FOCUS ?=
VELERO_CLI ?=$$(pwd)/../../_output/bin/$(GOOS)/$(GOARCH)/velero
VELERO_IMAGE ?= velero/velero:main
CRDS_VERSION ?= v1
VELERO_NAMESPACE ?= velero
CREDS_FILE ?=
BSL_BUCKET ?=
Expand Down Expand Up @@ -80,6 +81,7 @@ run: ginkgo
@$(GINKGO) -v -focus="$(GINKGO_FOCUS)" . -- -velerocli=$(VELERO_CLI) \
-velero-image=$(VELERO_IMAGE) \
-velero-namespace=$(VELERO_NAMESPACE) \
-crds-version=$(CRDS_VERSION) \
-credentials-file=$(CREDS_FILE) \
-bucket=$(BSL_BUCKET) \
-prefix=$(BSL_PREFIX) \
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func backup_restore_test(useVolumeSnapshots bool) {
Expect(err).To(Succeed())
if installVelero {
Expect(veleroInstall(context.Background(), veleroImage, veleroNamespace, cloudProvider, objectStoreProvider, useVolumeSnapshots,
cloudCredentialsFile, bslBucket, bslPrefix, bslConfig, vslConfig, "")).To(Succeed())
cloudCredentialsFile, bslBucket, bslPrefix, bslConfig, vslConfig, crdsVersion, "")).To(Succeed())
}
})

Expand Down
7 changes: 4 additions & 3 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (
)

var (
veleroCLI, veleroImage, cloudCredentialsFile, bslConfig, bslBucket, bslPrefix, vslConfig, cloudProvider, objectStoreProvider, veleroNamespace string
additionalBSLProvider, additionalBSLBucket, additionalBSLPrefix, additionalBSLConfig, additionalBSLCredentials string
installVelero bool
veleroCLI, veleroImage, cloudCredentialsFile, bslConfig, bslBucket, bslPrefix, vslConfig, cloudProvider, objectStoreProvider, veleroNamespace, crdsVersion string
additionalBSLProvider, additionalBSLBucket, additionalBSLPrefix, additionalBSLConfig, additionalBSLCredentials string
installVelero bool
)

func init() {
Expand All @@ -50,6 +50,7 @@ func init() {
flag.StringVar(&additionalBSLPrefix, "additional-bsl-prefix", "", "prefix under which all Velero data should be stored within the bucket for additional backup storage location. Optional.")
flag.StringVar(&additionalBSLConfig, "additional-bsl-config", "", "configuration to use for the additional backup storage location. Format is key1=value1,key2=value2")
flag.StringVar(&additionalBSLCredentials, "additional-bsl-credentials-file", "", "file containing credentials for additional backup storage location provider. Required if testing multiple credentials support.")
flag.StringVar(&crdsVersion, "crds-version", "v1", "CRD apiVersion for velero CRD creation.")
}

func TestE2e(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions test/e2e/enable_api_group_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ var _ = Describe("[APIGroup] Velero tests with various CRD API group versions",
bslPrefix,
bslConfig,
vslConfig,
crdsVersion,
"EnableAPIGroupVersions", // TODO: remove when feature flag is removed
)
Expect(err).NotTo(HaveOccurred())
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/multiple_namespaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var _ = Describe("[Basic] Backup/restore of 2 namespaces", func() {
Expect(err).To(Succeed())
if installVelero {
Expect(veleroInstall(context.Background(), veleroImage, veleroNamespace, cloudProvider, objectStoreProvider, false,
cloudCredentialsFile, bslBucket, bslPrefix, bslConfig, vslConfig, "")).To(Succeed())
cloudCredentialsFile, bslBucket, bslPrefix, bslConfig, vslConfig, crdsVersion, "")).To(Succeed())

}
})
Expand Down Expand Up @@ -65,7 +65,7 @@ var _ = Describe("[Scale] Backup/restore of 2500 namespaces", func() {
Expect(err).To(Succeed())
if installVelero {
Expect(veleroInstall(context.Background(), veleroImage, veleroNamespace, cloudProvider, objectStoreProvider, false,
cloudCredentialsFile, bslBucket, bslPrefix, bslConfig, vslConfig, "")).To(Succeed())
cloudCredentialsFile, bslBucket, bslPrefix, bslConfig, vslConfig, crdsVersion, "")).To(Succeed())

}
})
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/velero_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func veleroRestore(ctx context.Context, veleroCLI string, veleroNamespace string

func veleroInstall(ctx context.Context, veleroImage string, veleroNamespace string, cloudProvider string, objectStoreProvider string, useVolumeSnapshots bool,
cloudCredentialsFile string, bslBucket string, bslPrefix string, bslConfig string, vslConfig string,
features string) error {
crdsVersion string, features string) error {

if cloudProvider != "kind" {
if objectStoreProvider != "" {
Expand Down Expand Up @@ -330,6 +330,7 @@ func veleroInstall(ctx context.Context, veleroImage string, veleroNamespace stri
}
veleroInstallOptions.UseRestic = !useVolumeSnapshots
veleroInstallOptions.Image = veleroImage
veleroInstallOptions.CRDsVersion = crdsVersion
veleroInstallOptions.Namespace = veleroNamespace

err = installVeleroServer(veleroInstallOptions)
Expand Down

0 comments on commit 2c46b47

Please sign in to comment.