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

Introduce a file for assertions #424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rhmdnd
Copy link

@rhmdnd rhmdnd commented Sep 28, 2023

We have a smattering of assertions in different files within the
framework package. Even if you rely on your IDE to fill these in for
you, organizing them is good practice.

This commit adds a new file specifically for assertions, and populates
it with an existing assertion used in tests.

It also implements the ability for assertions to handle test outcomes,
instead of returning booleans, forcing the callers to handle test
outcomes. Although having test outcomes (e.g., FailNow) in the test is
clear, we check and call Fatal a lot across the test code. Moving the
outcome into the assertion allows the code to be a little more dry, and
clear if everyone agrees assertions should accept that reponsibility.

@openshift-ci openshift-ci bot requested review from jhrozek and xiaojiey September 28, 2023 14:43
@openshift-ci
Copy link

openshift-ci bot commented Sep 28, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhmdnd

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

@rhmdnd rhmdnd requested review from yuumasato and Vincent056 and removed request for jhrozek September 28, 2023 14:46
@rhmdnd rhmdnd added this to the 1.6.1 milestone Oct 11, 2024
@rhmdnd rhmdnd modified the milestones: 1.6.1, 1.7.0 Jan 7, 2025
We have a smattering of assertions in different files within the
`framework` package. Even if you rely on your IDE to fill these in for
you, organizing them is good practice.

This commit adds a new file specifically for assertions, and populates
it with an existing assertion used in tests.

It also implements the ability for assertions to handle test outcomes,
instead of returning booleans, forcing the callers to handle test
outcomes. Although having test outcomes (e.g., `FailNow`) in the test is
clear, we check and call `Fatal` a lot across the test code. Moving the
outcome into the assertion allows the code to be a little more dry, and
clear if everyone agrees assertions should accept that reponsibility.
@rhmdnd rhmdnd force-pushed the simplify-assertions branch from 4fee621 to 5b30875 Compare January 7, 2025 17:21
Copy link

github-actions bot commented Jan 7, 2025

🤖 To deploy this PR, run the following command:

make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:424-5b3087517a02ed13510ec9b2b2b0aaf0e05f72da

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

Successfully merging this pull request may close these issues.

1 participant