Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update OperatorPolicy tests for upgradeApproval #817

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/integration/operator_policy_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ var _ = Describe("GRC: [P1][Sev1][policy-grc] Test operatorpolicy errors",
Expect(err).ToNot(HaveOccurred())
})

It(operatorPolicyName+" should be patched with incorrect installPlanApproval", func() {
It(operatorPolicyName+" should be patched to specify installPlanApproval", func() {
_, err := common.OcHub(
"patch", "policies.policy.open-cluster-management.io", policyName,
"-n", userNamespace, "--type=json", "-p", `[{
"op":"replace",
"path":"/spec/policy-templates/0/objectDefinition/spec/subscription/installPlanApproval",
"value":"Invalid"
"value":"Automatic"
}]`)
Expect(err).ToNot(HaveOccurred())
})
Expand All @@ -121,6 +121,6 @@ var _ = Describe("GRC: [P1][Sev1][policy-grc] Test operatorpolicy errors",
common.GetOpPolicyCompMsg(operatorPolicyName),
defaultTimeoutSeconds,
1,
).Should(ContainSubstring("the policy spec.subscription.installPlanApproval ('Invalid') is invalid"))
).Should(ContainSubstring("installPlanApproval is prohibited in spec.subscription"))
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ spec:
channel: stable-3.8
name: quay-operator
namespace: ch-operator-policy-test-ns
installPlanApproval: Automatic
# correct one: redhat-operators
source: invalid
sourceNamespace: openshift-marketplace
upgradeApproval: Automatic
---
apiVersion: cluster.open-cluster-management.io/v1beta1
kind: Placement
Expand Down
2 changes: 1 addition & 1 deletion test/resources/compliance_history/policy-install-gk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ spec:
channel: stable
name: gatekeeper-operator-product
namespace: openshift-operators
installPlanApproval: Automatic
source: redhat-operators
sourceNamespace: openshift-marketplace
upgradeApproval: Automatic
- objectDefinition:
apiVersion: policy.open-cluster-management.io/v1
kind: ConfigurationPolicy
Expand Down
2 changes: 1 addition & 1 deletion test/resources/operator_policy/test-op-err-correct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ spec:
channel: stable-3.8
name: quay-operator
namespace: grcqeoptest-ns-43568
installPlanApproval: Automatic
source: redhat-operators
sourceNamespace: openshift-marketplace
upgradeApproval: Automatic
---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
Expand Down
2 changes: 1 addition & 1 deletion test/resources/operator_policy/test-op-err-initial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ spec:
channel: stable-3.8
name: quay-operator
namespace: grcqeoptest-notcreated
installPlanApproval: Automatic
source: redhat-operators
sourceNamespace: openshift-marketplace
upgradeApproval: Automatic
---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
subscription:
name: quay-operator
namespace: grcqeoptest-ns-47229
installPlanApproval: Automatic
upgradeApproval: Automatic
---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ spec:
channel: stable-3.8
name: quay-operator
namespace: grcqeoptest-ns-43544
installPlanApproval: Automatic
source: redhat-operators
sourceNamespace: openshift-marketplace
upgradeApproval: Automatic
---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ spec:
channel: stable-3.8
name: quay-operator
namespace: grcqeoptest-ns-43545
installPlanApproval: Automatic
source: redhat-operators
sourceNamespace: openshift-marketplace
upgradeApproval: Automatic
---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
Expand Down