Skip to content

Commit

Permalink
Remove the compliance history API tests
Browse files Browse the repository at this point in the history
The tech preview feature is being removed so the tests are no longer
needed.

Relates:
https://issues.redhat.com/browse/ACM-15291
https://issues.redhat.com/browse/ACM-13208

Signed-off-by: mprahl <[email protected]>
  • Loading branch information
mprahl authored and openshift-merge-bot[bot] committed Oct 31, 2024
1 parent 0ed8dc4 commit 8bca75b
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 1,718 deletions.
916 changes: 0 additions & 916 deletions test/integration/compliance_history_test.go

This file was deleted.

60 changes: 60 additions & 0 deletions test/integration/utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright Contributors to the Open Cluster Management project

package integration

import (
"context"
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

"github.com/stolostron/governance-policy-framework/test/common"
)

func verifyPolicyOnAllClusters(
ctx context.Context, namespace string, policy string, compliance string, timeout int,
) (
clusters []string,
) {
GinkgoHelper()

By(fmt.Sprintf("Verifying that the policy %s/%s is %s", namespace, policy, compliance))

Eventually(func(g Gomega) {
clusters = confirmComplianceOnAllClusters(ctx, namespace, policy, compliance)(g)
}, timeout, 1).Should(Succeed())

return
}

func confirmComplianceOnAllClusters(
ctx context.Context, namespace string, policy string, compliance string,
) func(g Gomega) []string {
return func(g Gomega) []string {
GinkgoHelper()

clusters := []string{}

parentPolicy, err := clientHubDynamic.Resource(common.GvrPolicy).Namespace(namespace).Get(
ctx, policy, metav1.GetOptions{},
)
g.Expect(err).ToNot(HaveOccurred())

perClusterStatus, _, _ := unstructured.NestedSlice(parentPolicy.Object, "status", "status")
g.Expect(perClusterStatus).ToNot(BeEmpty(), "no cluster status was available on the parent policy")

for _, clusterStatus := range perClusterStatus {
clusterStatus, ok := clusterStatus.(map[string]interface{})
g.Expect(ok).To(BeTrue(), "the cluster status was not the right type")

g.Expect(clusterStatus["compliant"]).To(Equal(compliance))
g.Expect(clusterStatus["clustername"]).ToNot(BeEmpty())
clusters = append(clusters, clusterStatus["clustername"].(string))
}

return clusters
}
}
53 changes: 0 additions & 53 deletions test/resources/compliance_history/cert-policy.yaml

This file was deleted.

71 changes: 0 additions & 71 deletions test/resources/compliance_history/cert-prereq.yaml

This file was deleted.

105 changes: 0 additions & 105 deletions test/resources/compliance_history/compliance-api-prerequisites.yaml

This file was deleted.

54 changes: 0 additions & 54 deletions test/resources/compliance_history/operator-policy-invalid.yaml

This file was deleted.

Loading

0 comments on commit 8bca75b

Please sign in to comment.