mirror of
https://github.com/vmware-tanzu/velero.git
synced 2025-12-23 14:25:22 +00:00
Add debug switcher for E2E test
Signed-off-by: danfengl <danfengl@vmware.com>
This commit is contained in:
@@ -84,6 +84,7 @@ ADDITIONAL_BSL_PREFIX ?=
|
|||||||
ADDITIONAL_BSL_CONFIG ?=
|
ADDITIONAL_BSL_CONFIG ?=
|
||||||
|
|
||||||
FEATURES ?=
|
FEATURES ?=
|
||||||
|
DEBUG_E2E_TEST ?= false
|
||||||
|
|
||||||
.PHONY:ginkgo
|
.PHONY:ginkgo
|
||||||
ginkgo: # Make sure ginkgo is in $GOPATH/bin
|
ginkgo: # Make sure ginkgo is in $GOPATH/bin
|
||||||
@@ -121,7 +122,8 @@ run: ginkgo
|
|||||||
-features=$(FEATURES) \
|
-features=$(FEATURES) \
|
||||||
-install-velero=$(INSTALL_VELERO) \
|
-install-velero=$(INSTALL_VELERO) \
|
||||||
-registry-credential-file=$(REGISTRY_CREDENTIAL_FILE) \
|
-registry-credential-file=$(REGISTRY_CREDENTIAL_FILE) \
|
||||||
-kibishii-directory=$(KIBISHII_DIRECTORY)
|
-kibishii-directory=$(KIBISHII_DIRECTORY) \
|
||||||
|
-debug-e2e-test=$(DEBUG_E2E_TEST)
|
||||||
|
|
||||||
build: ginkgo
|
build: ginkgo
|
||||||
mkdir -p $(OUTPUT_DIR)
|
mkdir -p $(OUTPUT_DIR)
|
||||||
|
|||||||
@@ -60,13 +60,12 @@ func BackupRestoreTest(useVolumeSnapshots bool) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
DeleteNamespace(context.Background(), client, kibishiiNamespace, true)
|
|
||||||
Expect(err).To(Succeed(), fmt.Sprintf("failed to delete the namespace %q", kibishiiNamespace))
|
|
||||||
|
|
||||||
if VeleroCfg.InstallVelero {
|
if VeleroCfg.InstallVelero {
|
||||||
|
if !VeleroCfg.Debug {
|
||||||
err = VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)
|
err = VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)
|
||||||
Expect(err).To(Succeed())
|
Expect(err).To(Succeed())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
When("kibishii is the sample workload", func() {
|
When("kibishii is the sample workload", func() {
|
||||||
|
|||||||
@@ -67,9 +67,11 @@ func backup_deletion_test(useVolumeSnapshots bool) {
|
|||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
if VeleroCfg.InstallVelero {
|
if VeleroCfg.InstallVelero {
|
||||||
|
if !VeleroCfg.Debug {
|
||||||
err = VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)
|
err = VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)
|
||||||
Expect(err).To(Succeed())
|
Expect(err).To(Succeed())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
When("kibishii is the sample workload", func() {
|
When("kibishii is the sample workload", func() {
|
||||||
|
|||||||
@@ -67,8 +67,10 @@ func BackupsSyncTest() {
|
|||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
if VeleroCfg.InstallVelero {
|
if VeleroCfg.InstallVelero {
|
||||||
|
if !VeleroCfg.Debug {
|
||||||
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To(Succeed())
|
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Backups in object storage should be synced to a new Velero successfully", func() {
|
It("Backups in object storage should be synced to a new Velero successfully", func() {
|
||||||
|
|||||||
@@ -76,9 +76,11 @@ func APIGropuVersionsTest() {
|
|||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
if VeleroCfg.InstallVelero {
|
if VeleroCfg.InstallVelero {
|
||||||
|
if !VeleroCfg.Debug {
|
||||||
err = VeleroUninstall(ctx, VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)
|
err = VeleroUninstall(ctx, VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -70,12 +70,14 @@ func BslDeletionTest(useVolumeSnapshots bool) {
|
|||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
if VeleroCfg.InstallVelero {
|
if VeleroCfg.InstallVelero {
|
||||||
|
if !VeleroCfg.Debug {
|
||||||
Expect(DeleteNamespace(context.Background(), client, bslDeletionTestNs,
|
Expect(DeleteNamespace(context.Background(), client, bslDeletionTestNs,
|
||||||
true)).To(Succeed(), fmt.Sprintf("failed to delete the namespace %q",
|
true)).To(Succeed(), fmt.Sprintf("failed to delete the namespace %q",
|
||||||
bslDeletionTestNs))
|
bslDeletionTestNs))
|
||||||
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI,
|
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI,
|
||||||
VeleroCfg.VeleroNamespace)).To(Succeed())
|
VeleroCfg.VeleroNamespace)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
When("kibishii is the sample workload", func() {
|
When("kibishii is the sample workload", func() {
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ func init() {
|
|||||||
flag.StringVar(&VeleroCfg.AdditionalBSLConfig, "additional-bsl-config", "", "configuration to use for the additional backup storage location. Format is key1=value1,key2=value2")
|
flag.StringVar(&VeleroCfg.AdditionalBSLConfig, "additional-bsl-config", "", "configuration to use for the additional backup storage location. Format is key1=value1,key2=value2")
|
||||||
flag.StringVar(&VeleroCfg.AdditionalBSLCredentials, "additional-bsl-credentials-file", "", "file containing credentials for additional backup storage location provider. Required if testing multiple credentials support.")
|
flag.StringVar(&VeleroCfg.AdditionalBSLCredentials, "additional-bsl-credentials-file", "", "file containing credentials for additional backup storage location provider. Required if testing multiple credentials support.")
|
||||||
flag.StringVar(&VeleroCfg.Features, "features", "", "Comma-separated list of features to enable for this Velero process.")
|
flag.StringVar(&VeleroCfg.Features, "features", "", "Comma-separated list of features to enable for this Velero process.")
|
||||||
|
flag.BoolVar(&VeleroCfg.Debug, "debug-e2e-test", false, "Switch to control namespace cleaning.")
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = Describe("[APIGroup] Velero tests with various CRD API group versions", APIGropuVersionsTest)
|
var _ = Describe("[APIGroup] Velero tests with various CRD API group versions", APIGropuVersionsTest)
|
||||||
|
|||||||
@@ -51,8 +51,10 @@ func SSRTest() {
|
|||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
if VeleroCfg.InstallVelero {
|
if VeleroCfg.InstallVelero {
|
||||||
|
if !VeleroCfg.Debug {
|
||||||
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To(Succeed())
|
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
It(fmt.Sprintf("Should create an ssr object in the %s namespace and later removed by controller", VeleroCfg.VeleroNamespace), func() {
|
It(fmt.Sprintf("Should create an ssr object in the %s namespace and later removed by controller", VeleroCfg.VeleroNamespace), func() {
|
||||||
|
|||||||
@@ -84,8 +84,10 @@ func TestFunc(test VeleroBackupRestoreTest) func() {
|
|||||||
})
|
})
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
if VeleroCfg.InstallVelero {
|
if VeleroCfg.InstallVelero {
|
||||||
|
if !VeleroCfg.Debug {
|
||||||
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To((Succeed()))
|
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To((Succeed()))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
It(test.GetTestMsg().Text, func() {
|
It(test.GetTestMsg().Text, func() {
|
||||||
Expect(RunTestCase(test)).To(Succeed(), test.GetTestMsg().FailedMSG)
|
Expect(RunTestCase(test)).To(Succeed(), test.GetTestMsg().FailedMSG)
|
||||||
@@ -115,7 +117,7 @@ func TestFuncWithMultiIt(tests []VeleroBackupRestoreTest) func() {
|
|||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
if VeleroCfg.InstallVelero {
|
if VeleroCfg.InstallVelero {
|
||||||
if countIt == len(tests) {
|
if countIt == len(tests) && !VeleroCfg.Debug {
|
||||||
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To((Succeed()))
|
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To((Succeed()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ type VerleroConfig struct {
|
|||||||
InstallVelero bool
|
InstallVelero bool
|
||||||
KibishiiDirectory string
|
KibishiiDirectory string
|
||||||
Features string
|
Features string
|
||||||
|
Debug bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type SnapshotCheckPoint struct {
|
type SnapshotCheckPoint struct {
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ func BackupUpgradeRestoreTest(useVolumeSnapshots bool, upgradeFromVelero Upgrade
|
|||||||
})
|
})
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
if VeleroCfg.InstallVelero {
|
if VeleroCfg.InstallVelero {
|
||||||
|
if !VeleroCfg.Debug {
|
||||||
By(fmt.Sprintf("Delete sample workload namespace %s", upgradeNamespace), func() {
|
By(fmt.Sprintf("Delete sample workload namespace %s", upgradeNamespace), func() {
|
||||||
DeleteNamespace(context.Background(), client, upgradeNamespace, true)
|
DeleteNamespace(context.Background(), client, upgradeNamespace, true)
|
||||||
})
|
})
|
||||||
@@ -102,6 +103,7 @@ func BackupUpgradeRestoreTest(useVolumeSnapshots bool, upgradeFromVelero Upgrade
|
|||||||
VeleroCfg.VeleroNamespace)).To(Succeed())
|
VeleroCfg.VeleroNamespace)).To(Succeed())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
When("kibishii is the sample workload", func() {
|
When("kibishii is the sample workload", func() {
|
||||||
It("should be successfully backed up and restored to the default BackupStorageLocation", func() {
|
It("should be successfully backed up and restored to the default BackupStorageLocation", func() {
|
||||||
|
|||||||
@@ -46,11 +46,22 @@ func RunKibishiiTests(client TestClient, veleroCfg VerleroConfig, backupName, re
|
|||||||
registryCredentialFile := VeleroCfg.RegistryCredentialFile
|
registryCredentialFile := VeleroCfg.RegistryCredentialFile
|
||||||
veleroFeatures := VeleroCfg.Features
|
veleroFeatures := VeleroCfg.Features
|
||||||
kibishiiDirectory := VeleroCfg.KibishiiDirectory
|
kibishiiDirectory := VeleroCfg.KibishiiDirectory
|
||||||
|
if _, err := GetNamespace(context.Background(), client, kibishiiNamespace); err == nil {
|
||||||
|
fmt.Printf("Workload namespace %s exists, delete it first.", kibishiiNamespace)
|
||||||
|
if err = DeleteNamespace(context.Background(), client, kibishiiNamespace, true); err != nil {
|
||||||
|
fmt.Println(errors.Wrapf(err, "failed to delete the namespace %q", kibishiiNamespace))
|
||||||
|
}
|
||||||
|
}
|
||||||
if err := CreateNamespace(oneHourTimeout, client, kibishiiNamespace); err != nil {
|
if err := CreateNamespace(oneHourTimeout, client, kibishiiNamespace); err != nil {
|
||||||
return errors.Wrapf(err, "Failed to create namespace %s to install Kibishii workload", kibishiiNamespace)
|
return errors.Wrapf(err, "Failed to create namespace %s to install Kibishii workload", kibishiiNamespace)
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if !veleroCfg.Debug {
|
||||||
|
if err := DeleteNamespace(context.Background(), client, kibishiiNamespace, true); err != nil {
|
||||||
|
fmt.Println(errors.Wrapf(err, "failed to delete the namespace %q", kibishiiNamespace))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
if err := KibishiiPrepareBeforeBackup(oneHourTimeout, client, providerName,
|
if err := KibishiiPrepareBeforeBackup(oneHourTimeout, client, providerName,
|
||||||
kibishiiNamespace, registryCredentialFile, veleroFeatures,
|
kibishiiNamespace, registryCredentialFile, veleroFeatures,
|
||||||
kibishiiDirectory, useVolumeSnapshots); err != nil {
|
kibishiiDirectory, useVolumeSnapshots); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user