Skip to content

Commit

Permalink
Fix nil panic, add debug to CRD validation
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Squizzato <[email protected]>
  • Loading branch information
squizzi committed Oct 1, 2024
1 parent 9451437 commit 2cd1be6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions test/e2e/managedcluster/clusteridentity/clusteridentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"fmt"
"os"
"time"

"github.com/Mirantis/hmc/test/e2e/kubeclient"
"github.com/Mirantis/hmc/test/e2e/managedcluster"
Expand Down Expand Up @@ -117,10 +118,14 @@ func (ci *ClusterIdentity) waitForResourceCRD(kc *kubeclient.KubeClient) {
ctx := context.Background()
client := kc.GetDynamicClient(ci.GroupVersionResource)

Eventually(func() bool {
_, err := client.List(ctx, metav1.ListOptions{})
return err == nil
}, "1m", "5s").Should(BeTrue(), "failed to list %s", ci.GroupVersionResource.String())
Eventually(func() error {
if _, err := client.List(ctx, metav1.ListOptions{}); err != nil {
_, _ = fmt.Fprintf(GinkgoWriter, "failed to list %s resources: %v, retrying...\n", ci.GroupVersionResource.Resource, err)
return err
}
_, _ = fmt.Fprintf(GinkgoWriter, "CRD available\n")
return nil
}).WithTimeout(time.Minute).WithPolling(5 * time.Second).Should(Succeed())
}

// createSecret creates a secret affiliated with a ClusterIdentity.
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/managedcluster/validate_deployed.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func validateCSIDriver(ctx context.Context, kc *kubeclient.KubeClient, clusterNa
return fmt.Errorf("failed to get test PVC: %w", err)
}

if !strings.Contains(*pvc.Spec.StorageClassName, "csi") {
if pvc.Spec.StorageClassName != nil && !strings.Contains(*pvc.Spec.StorageClassName, "csi") {
Fail(fmt.Sprintf("%s PersistentVolumeClaim does not have a CSI driver storageClass", pvcName))
}

Expand Down

0 comments on commit 2cd1be6

Please sign in to comment.