From 70a8a5d54db097cff01b77f941fb49328dd243a2 Mon Sep 17 00:00:00 2001 From: Daniel Jiang Date: Tue, 31 Aug 2021 21:01:21 +0800 Subject: [PATCH] Enhance e2e test 1. Check the error when waiting for restice daemonset to be ready, so the timeout will be reported 2. Add support for gcp provider and fail early if the provider is unknown Signed-off-by: Daniel Jiang --- test/e2e/install.go | 5 ++++- test/e2e/velero_utils.go | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test/e2e/install.go b/test/e2e/install.go index 0d31f8d82..667720274 100644 --- a/test/e2e/install.go +++ b/test/e2e/install.go @@ -280,7 +280,7 @@ func waitVeleroReady(ctx context.Context, namespace string, useRestic bool) erro if useRestic { fmt.Println("Waiting for Velero restic daemonset to be ready.") - wait.PollImmediate(5*time.Second, 1*time.Minute, func() (bool, error) { + err := wait.PollImmediate(5*time.Second, 1*time.Minute, func() (bool, error) { stdout, stderr, err := velerexec.RunCommand(exec.CommandContext(ctx, "kubectl", "get", "daemonset/restic", "-o", "json", "-n", namespace)) if err != nil { @@ -295,6 +295,9 @@ func waitVeleroReady(ctx context.Context, namespace string, useRestic bool) erro } return false, nil }) + if err != nil { + return errors.Wrap(err, "fail to wait for the velero restic ready") + } } fmt.Printf("Velero is installed and ready to be tested in the %s namespace! ⛵ \n", namespace) diff --git a/test/e2e/velero_utils.go b/test/e2e/velero_utils.go index fcdfec0b5..f19841643 100644 --- a/test/e2e/velero_utils.go +++ b/test/e2e/velero_utils.go @@ -46,8 +46,10 @@ func getProviderPlugins(providerName string) []string { return []string{"velero/velero-plugin-for-microsoft-azure:v1.2.0"} case "vsphere": return []string{"velero/velero-plugin-for-aws:v1.2.1", "vsphereveleroplugin/velero-plugin-for-vsphere:v1.1.1"} + case "gcp": + return []string{"velero/velero-plugin-for-gcp:v1.2.1"} default: - return []string{""} + panic(fmt.Errorf("unknown provider name: %s", providerName)) } }