Add verification for CRD installation

Signed-off-by: danfengl <danfengl@vmware.com>
This commit is contained in:
danfengl
2022-11-25 01:21:16 +00:00
parent 9dbd9694d8
commit 3c3f041bc1
4 changed files with 17 additions and 2 deletions

View File

@@ -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())
})

View File

@@ -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

View File

@@ -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
}

View File

@@ -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),