Extract and expose evaluation/assertion logic for checks #642
Labels
kind/feature
Categorizes issue or PR as related to a new feature.
lifecycle/stale
Denotes an issue or PR has remained open with no activity and has become stale.
Problems
In several places, we bind tasks that are important for our execution to tasks that perform data verification, comparison etc.
Another example might be test cases, where we need to write information to a file (say, as an artifact), and we first must verify certain elements of the data we need to validate before we write it.
In some cases, we also store this logic behind our internal packages, in our checks themselves.
There’s value, at the very least from a testing perspective, and beyond that - to users who may want to perform preflight checks within their own test code, to decoupling the logic behind validating a check’s criteria against raw data, and performing other logic.
The solution should:
One of the simplest examples (and therefore one of the locations where we’d get the least amount of value, arguably) would be the HasRequiredLabels check.
https://github.com/redhat-openshift-ecosystem/openshift-preflight/blob/main/certification/internal/policy/container/has_required_labels.go#L31-L48
This validation could effectively be a public function that we then call in this method.
Similar/Related: #639
The text was updated successfully, but these errors were encountered: