forked from vmware-tanzu/velero
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
E2E tests now run in multiple clouds in addition to KIND (vmware-tanz…
…u#3286) Split plug-in provider into cloud provider/object provider Moved velero install/uninstall for tests into velero_utils Added remove of CRDs to test v elero uninstall Added remove of cluster role binding to test velero uninstall Added dump of velero describe and logs on error Added velero namespace argument to velero_utils functions Modified api group versions e2e tests to use VeleroInstall Added velero logs dumps for api group versions e2e testing Added DeleteNamespace to test/e2e/common.go Fixed VeleroInstall to use the image specified Changed enable_api_group_versions_test to use veleroNamespace instead of hardcoded "velero" Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
- Loading branch information
Showing
9 changed files
with
282 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,60 @@ | ||
package e2e | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
"fmt" | ||
"time" | ||
|
||
"github.com/google/uuid" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
"golang.org/x/net/context" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
apiextensionsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" | ||
"k8s.io/client-go/kubernetes" | ||
|
||
"github.com/vmware-tanzu/velero/pkg/cmd/cli/install" | ||
) | ||
|
||
var ( | ||
uuidgen uuid.UUID | ||
veleroInstallOptions *install.InstallOptions | ||
uuidgen uuid.UUID | ||
) | ||
|
||
func veleroInstall(pluginProvider string, useRestic bool) { | ||
var err error | ||
flag.Parse() | ||
Expect(EnsureClusterExists(context.TODO())).To(Succeed(), "Failed to ensure kubernetes cluster exists") | ||
uuidgen, err = uuid.NewRandom() | ||
Expect(err).To(Succeed()) | ||
veleroInstallOptions, err = GetProviderVeleroInstallOptions(pluginProvider, cloudCredentialsFile, bslBucket, bslPrefix, bslConfig, vslConfig, getProviderPlugins(pluginProvider)) | ||
Expect(err).To(Succeed(), fmt.Sprintf("Failed to get Velero InstallOptions for plugin provider %s", pluginProvider)) | ||
veleroInstallOptions.UseRestic = useRestic | ||
Expect(InstallVeleroServer(veleroInstallOptions)).To(Succeed(), "Failed to install Velero on KinD cluster") | ||
} | ||
|
||
// Test backup and restore of Kibishi using restic | ||
var _ = Describe("[Restic] [KinD] Velero tests on KinD cluster using the plugin provider for object storage and Restic for volume backups", func() { | ||
var _ = Describe("[Restic] Velero tests on cluster using the plugin provider for object storage and Restic for volume backups", func() { | ||
var ( | ||
client *kubernetes.Clientset | ||
backupName string | ||
restoreName string | ||
client *kubernetes.Clientset | ||
extensionsClient *apiextensionsclientset.Clientset | ||
backupName string | ||
restoreName string | ||
) | ||
|
||
BeforeEach(func() { | ||
var err error | ||
veleroInstall(pluginProvider, true) | ||
client, err = GetClusterClient() | ||
flag.Parse() | ||
uuidgen, err = uuid.NewRandom() | ||
Expect(err).To(Succeed()) | ||
if installVelero { | ||
VeleroInstall(context.Background(), veleroImage, veleroNamespace, cloudProvider, objectStoreProvider, useVolumeSnapshots, | ||
cloudCredentialsFile, bslBucket, bslPrefix, bslConfig, vslConfig, "") | ||
} | ||
client, extensionsClient, err = GetClusterClient() | ||
Expect(err).To(Succeed(), "Failed to instantiate cluster client") | ||
}) | ||
|
||
AfterEach(func() { | ||
timeoutCTX, _ := context.WithTimeout(context.Background(), time.Minute) | ||
err := client.CoreV1().Namespaces().Delete(timeoutCTX, veleroInstallOptions.Namespace, metav1.DeleteOptions{}) | ||
Expect(err).To(Succeed()) | ||
if installVelero { | ||
timeoutCTX, _ := context.WithTimeout(context.Background(), time.Minute) | ||
err := VeleroUninstall(timeoutCTX, client, extensionsClient, veleroNamespace) | ||
Expect(err).To(Succeed()) | ||
} | ||
|
||
}) | ||
|
||
Context("When kibishii is the sample workload", func() { | ||
It("should be successfully backed up and restored", func() { | ||
backupName = "backup-" + uuidgen.String() | ||
restoreName = "restore-" + uuidgen.String() | ||
// Even though we are using Velero's CloudProvider plugin for object storage, the kubernetes cluster is running on | ||
// KinD. So use the kind installation for Kibishii. | ||
Expect(RunKibishiiTests(client, "kind", veleroCLI, backupName, restoreName)).To(Succeed(), "Failed to successfully backup and restore Kibishii namespace") | ||
Expect(RunKibishiiTests(client, cloudProvider, veleroCLI, veleroNamespace, backupName, restoreName)).To(Succeed(), | ||
"Failed to successfully backup and restore Kibishii namespace") | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.