check works in the addon management e2e case (#1015)
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Failing after 2m2s
Post / coverage (push) Failing after 32m55s
Post / images (amd64) (push) Failing after 8m22s
Post / images (arm64) (push) Failing after 7m55s
Post / image manifest (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Close stale issues and PRs / stale (push) Successful in 54s

Signed-off-by: Zhiwei Yin <zyin@redhat.com>
This commit is contained in:
Zhiwei Yin
2025-06-06 19:44:59 +08:00
committed by GitHub
parent 0734a0b763
commit ea80afec78

View File

@@ -42,7 +42,7 @@ const (
originalImageValue = "quay.io/open-cluster-management/addon-examples:latest"
overrideImageValue = "quay.io/ocm/addon-examples:latest"
customSignerName = "example.com/signer-name"
//#nosec G101
// #nosec G101
customSignerSecretName = "addon-signer-secret"
)
@@ -153,14 +153,23 @@ var _ = ginkgo.Describe("Enable addon management feature gate", ginkgo.Ordered,
gomega.Eventually(func() error {
_, err := hub.AddonClient.AddonV1alpha1().ManagedClusterAddOns(universalClusterName).Get(
context.TODO(), addOnName, metav1.GetOptions{})
if err != nil {
if errors.IsNotFound(err) {
return nil
}
if err == nil {
return fmt.Errorf("the managedClusterAddon %s should be deleted", addOnName)
}
if err != nil && !errors.IsNotFound(err) {
return err
}
return fmt.Errorf("the managedClusterAddon %s should be deleted", addOnName)
// check works after addon is not found
works, err := hub.WorkClient.WorkV1().ManifestWorks(universalClusterName).List(
context.TODO(), metav1.ListOptions{})
if err == nil && len(works.Items) != 0 {
return fmt.Errorf("expected no works,but got: %+v", works.Items)
}
if err != nil && !errors.IsNotFound(err) {
return err
}
return nil
}).ShouldNot(gomega.HaveOccurred())
ginkgo.By(fmt.Sprintf("delete addon template resources for cluster %v", universalClusterName))