From 3c3f041bc133c943f1ab923d3c93b52cc3df05c7 Mon Sep 17 00:00:00 2001 From: danfengl Date: Fri, 25 Nov 2022 01:21:16 +0000 Subject: [PATCH] Add verification for CRD installation Signed-off-by: danfengl --- test/e2e/basic/enable_api_group_versions.go | 1 + test/e2e/migration/migration.go | 2 +- test/e2e/util/k8s/common.go | 14 ++++++++++++++ test/e2e/util/kibishii/kibishii_utils.go | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/test/e2e/basic/enable_api_group_versions.go b/test/e2e/basic/enable_api_group_versions.go index 862854a02..cf6db22d7 100644 --- a/test/e2e/basic/enable_api_group_versions.go +++ b/test/e2e/basic/enable_api_group_versions.go @@ -115,6 +115,7 @@ func APIExtensionsVersionsTest() { By(fmt.Sprintf("Install CRD of apiextenstions v1beta1 in cluster-A (%s)", VeleroCfg.DefaultCluster), func() { Expect(installCRD(context.Background(), srcCrdYaml)).To(Succeed()) Expect(CRDShouldExist(context.Background(), crdName)).To(Succeed()) + Expect(WaitForCRDEstablished(crdName)).To(Succeed()) Expect(AddLabelToCRD(context.Background(), crdName, label)).To(Succeed()) }) diff --git a/test/e2e/migration/migration.go b/test/e2e/migration/migration.go index 8b163b111..f266e5825 100644 --- a/test/e2e/migration/migration.go +++ b/test/e2e/migration/migration.go @@ -98,7 +98,7 @@ func MigrationTest(useVolumeSnapshots bool, veleroCLI2Version VeleroCLI2Version) UUIDgen, err = uuid.NewRandom() Expect(err).To(Succeed()) - oneHourTimeout, _ := context.WithTimeout(context.Background(), time.Minute*10) + oneHourTimeout, _ := context.WithTimeout(context.Background(), time.Minute*60) if veleroCLI2Version.VeleroCLI == "" { //Assume tag of velero server image is identical to velero CLI version diff --git a/test/e2e/util/k8s/common.go b/test/e2e/util/k8s/common.go index 7b2d75edb..6ea041dfd 100644 --- a/test/e2e/util/k8s/common.go +++ b/test/e2e/util/k8s/common.go @@ -327,3 +327,17 @@ func DeleteVeleroDs(ctx context.Context) error { fmt.Println(args) return exec.CommandContext(ctx, "kubectl", args...).Run() } + +func WaitForCRDEstablished(crdName string) error { + arg := []string{"wait", "--for", "condition=established", "--timeout=60s", "crd/" + crdName} + cmd := exec.CommandContext(context.Background(), "kubectl", arg...) + fmt.Printf("Kubectl exec cmd =%v\n", cmd) + stdout, stderr, err := veleroexec.RunCommand(cmd) + fmt.Println(stdout) + if err != nil { + fmt.Println(stderr) + fmt.Println(err) + return err + } + return nil +} diff --git a/test/e2e/util/kibishii/kibishii_utils.go b/test/e2e/util/kibishii/kibishii_utils.go index c09ac7748..fc7471f47 100644 --- a/test/e2e/util/kibishii/kibishii_utils.go +++ b/test/e2e/util/kibishii/kibishii_utils.go @@ -174,7 +174,7 @@ func installKibishii(ctx context.Context, namespace string, cloudPlatform, veler } func generateData(ctx context.Context, namespace string, kibishiiData *KibishiiData) error { - timeout, _ := context.WithTimeout(context.Background(), time.Minute*10) + timeout, _ := context.WithTimeout(context.Background(), time.Minute*20) kibishiiGenerateCmd := exec.CommandContext(timeout, "kubectl", "exec", "-n", namespace, "jump-pad", "--", "/usr/local/bin/generate.sh", strconv.Itoa(kibishiiData.Levels), strconv.Itoa(kibishiiData.DirsPerLevel), strconv.Itoa(kibishiiData.FilesPerLevel), strconv.Itoa(kibishiiData.FileLength),