Skip to content

Fix spec fetching for Compliance API #175

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

Merged
merged 1 commit into from
Feb 7, 2024
Merged

Fix spec fetching for Compliance API #175

merged 1 commit into from
Feb 7, 2024

Conversation

mprahl
Copy link
Member

@mprahl mprahl commented Feb 7, 2024

This was also incorrectly setting the replicated policy annotations on the policy template's annotations.

Built from #174

Copy link
Member

@dhaiducek dhaiducek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I have some comments to consider about the test.

Comment on lines 139 to 148
Eventually(func(g Gomega) interface{} {
plc = utils.GetWithTimeout(
clientHubDynamic, gvrPolicy, testNamespace+"."+case3PolicyName, "managed2", true, defaultTimeoutSeconds,
)

utils.RemovePolicyTemplateDBAnnotations(g, plc)

return plc.Object["spec"]
}, defaultTimeoutSeconds, 1).Should(utils.SemanticEqual(rootPlc.Object["spec"]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Optional) This seems so common it could be part of a new util function that wraps both functions and returns the spec, something like:

		Eventually(
			utils.GetCleanPolicy(
				clientHubDynamic, 
				gvrPolicy,
				testNamespace+"."+case3PolicyName,
				"managed2", 
				true, 
				defaultTimeoutSeconds,
			), defaultTimeoutSeconds, 1).Should(utils.SemanticEqual(rootPlc.Object["spec"]))

With that, you can return spec and the error and Ginkgo will fail the test accordingly on error: https://onsi.github.io/gomega/#category-2-making-codeeventuallycode-assertions-on-functions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to skip this suggestion since time is tight.

This was also incorrectly setting the replicated policy annotations on
the policy template's annotations.

Co-authored-by: Dale Haiducek <[email protected]>
Signed-off-by: mprahl <[email protected]>
@mprahl mprahl requested a review from dhaiducek February 7, 2024 16:23
Copy link

openshift-ci bot commented Feb 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dhaiducek, mprahl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants