Skip to content

Commit

Permalink
Add additional test for TooManyOperatorGroups
Browse files Browse the repository at this point in the history
There was already one like this when the OperatorGroup was not being
specified in the OperatorPolicy, but this helps keep things complete.

Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
  • Loading branch information
JustinKuli authored and openshift-merge-bot[bot] committed Feb 1, 2024
1 parent 1895478 commit 3da5031
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/e2e/case38_install_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ var _ = Describe("Test installing an operator from OperatorPolicy", Ordered, fun
incorrectOpGroupName = "incorrect-operator-group"
scopedOpGroupYAML = "../resources/case38_operator_install/scoped-operator-group.yaml"
scopedOpGroupName = "scoped-operator-group"
extraOpGroupYAML = "../resources/case38_operator_install/extra-operator-group.yaml"
extraOpGroupName = "extra-operator-group"
)

BeforeAll(func() {
Expand Down Expand Up @@ -344,6 +346,39 @@ var _ = Describe("Test installing an operator from OperatorPolicy", Ordered, fun
"the OperatorGroup was updated to match the policy",
)
})
It("Should become NonCompliant when an extra OperatorGroup is added", func() {
utils.Kubectl("apply", "-f", extraOpGroupYAML, "-n", opPolTestNS)
check(
opPolName,
true,
[]policyv1.RelatedObject{{
Object: policyv1.ObjectResource{
Kind: "OperatorGroup",
APIVersion: "operators.coreos.com/v1",
},
Compliant: "NonCompliant",
Reason: "There is more than one OperatorGroup in this namespace",
}, {
Object: policyv1.ObjectResource{
Kind: "OperatorGroup",
APIVersion: "operators.coreos.com/v1",
Metadata: policyv1.ObjectMetadata{
Name: extraOpGroupName,
Namespace: opPolTestNS,
},
},
Compliant: "NonCompliant",
Reason: "There is more than one OperatorGroup in this namespace",
}},
metav1.Condition{
Type: "OperatorGroupCompliant",
Status: metav1.ConditionFalse,
Reason: "TooManyOperatorGroups",
Message: "there is more than one OperatorGroup in the namespace",
},
"there is more than one OperatorGroup in the namespace",
)
})
})
Describe("Testing Subscription behavior for musthave mode while enforcing", Ordered, func() {
const (
Expand Down

0 comments on commit 3da5031

Please sign in to comment.