mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-02-10 05:50:22 +00:00
* remove checked in binary and update test/e2e Makefile Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * remove platform specific tests for now Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * install velero before running tests and robust makefiles Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * changelog Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * running e2e tests expects credentials file to be supplied run e2e tests on velero/velero:main image by default Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * refactor to parameterize tests Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * rename files to use provider tests convention Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * rename tests file Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * remove providerName config Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * run kibishii test on azure Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * refactor to make bsl vsl configurable Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * skip e2e tests when not explicitly running e2e tests Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * update e2e docs Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * refactor and update docs Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * refactor Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * cleanup Signed-off-by: Ashish Amarnath <ashisham@vmware.com> * use velero's exec package Signed-off-by: Ashish Amarnath <ashisham@vmware.com> Co-authored-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
64 lines
2.3 KiB
Go
64 lines
2.3 KiB
Go
package e2e
|
|
|
|
import (
|
|
"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"
|
|
"k8s.io/client-go/kubernetes"
|
|
|
|
"github.com/vmware-tanzu/velero/pkg/cmd/cli/install"
|
|
)
|
|
|
|
var (
|
|
uuidgen uuid.UUID
|
|
veleroInstallOptions *install.InstallOptions
|
|
)
|
|
|
|
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 (
|
|
client *kubernetes.Clientset
|
|
backupName string
|
|
restoreName string
|
|
)
|
|
BeforeEach(func() {
|
|
var err error
|
|
veleroInstall(pluginProvider, true)
|
|
client, 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())
|
|
})
|
|
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")
|
|
})
|
|
})
|
|
})
|