-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allow more than one skip functions per check. #1645
Merged
sebrandon1
merged 1 commit into
redhat-best-practices-for-k8s:ginkgo_removal
from
greyerof:ginkgo_removal_multi_skip_func_setter
Nov 20, 2023
Merged
Allow more than one skip functions per check. #1645
sebrandon1
merged 1 commit into
redhat-best-practices-for-k8s:ginkgo_removal
from
greyerof:ginkgo_removal_multi_skip_func_setter
Nov 20, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The check.WithSkipFn(func) has been replaced by a variadic func version to allow more than one skip functions to be called: check.WithSkipFn(skipFunc1, skipFunc2...) By default, the check will be skipped if any skip function returns true when they're called (which happens before running the CheckFn). If we need to skip the check in case all the skip functions return true, the check.WithSkipModeAll() needs to be used. Examples: 1. Skip check if no deployments *or* no statefulsets were found (testhelper.SkipIfEmptyAny()): check := checksdb.NewCheck(id, labels). WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env), testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). WithCheckFn(func() error { .. }) 2. We want to skip the check if no deployments *and* no statefulsets were found (testhelper.SkipIfEmptyAll()): check := checksdb.NewCheck(id, labels). WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env), testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). WithSkipCheckModeAll(). WithCheckFn(func() error { .. }) The skip functions are appended to a slice in the same order as they're passed to the check.WithSkipCheckFn() calls, and it can be called more than once. E.g.: in the previous examples, this call: ... WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env), testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). ... is equal to: ... WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env)). WithSkipCheckFn(testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). ... Extra changes: - Added helper skip func creators in the testhelper package for no CRDs, no statefulSets and no deployments found. - Adapted the observability ts.
sebrandon1
approved these changes
Nov 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
sebrandon1
merged commit Nov 20, 2023
be56aa9
into
redhat-best-practices-for-k8s:ginkgo_removal
8 checks passed
sebrandon1
pushed a commit
to sebrandon1/certsuite
that referenced
this pull request
Nov 21, 2023
…for-k8s#1645) The check.WithSkipFn(func) has been replaced by a variadic func version to allow more than one skip functions to be called: check.WithSkipFn(skipFunc1, skipFunc2...) By default, the check will be skipped if any skip function returns true when they're called (which happens before running the CheckFn). If we need to skip the check in case all the skip functions return true, the check.WithSkipModeAll() needs to be used. Examples: 1. Skip check if no deployments *or* no statefulsets were found (testhelper.SkipIfEmptyAny()): check := checksdb.NewCheck(id, labels). WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env), testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). WithCheckFn(func() error { .. }) 2. We want to skip the check if no deployments *and* no statefulsets were found (testhelper.SkipIfEmptyAll()): check := checksdb.NewCheck(id, labels). WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env), testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). WithSkipCheckModeAll(). WithCheckFn(func() error { .. }) The skip functions are appended to a slice in the same order as they're passed to the check.WithSkipCheckFn() calls, and it can be called more than once. E.g.: in the previous examples, this call: ... WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env), testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). ... is equal to: ... WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env)). WithSkipCheckFn(testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). ... Extra changes: - Added helper skip func creators in the testhelper package for no CRDs, no statefulSets and no deployments found. - Adapted the observability ts.
sebrandon1
pushed a commit
to sebrandon1/certsuite
that referenced
this pull request
Nov 21, 2023
…for-k8s#1645) The check.WithSkipFn(func) has been replaced by a variadic func version to allow more than one skip functions to be called: check.WithSkipFn(skipFunc1, skipFunc2...) By default, the check will be skipped if any skip function returns true when they're called (which happens before running the CheckFn). If we need to skip the check in case all the skip functions return true, the check.WithSkipModeAll() needs to be used. Examples: 1. Skip check if no deployments *or* no statefulsets were found (testhelper.SkipIfEmptyAny()): check := checksdb.NewCheck(id, labels). WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env), testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). WithCheckFn(func() error { .. }) 2. We want to skip the check if no deployments *and* no statefulsets were found (testhelper.SkipIfEmptyAll()): check := checksdb.NewCheck(id, labels). WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env), testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). WithSkipCheckModeAll(). WithCheckFn(func() error { .. }) The skip functions are appended to a slice in the same order as they're passed to the check.WithSkipCheckFn() calls, and it can be called more than once. E.g.: in the previous examples, this call: ... WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env), testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). ... is equal to: ... WithSkipCheckFn(testhelper.GetNoDeploymentsUnderTestSkipFn(&env)). WithSkipCheckFn(testhelper.GetNoStatefulSetsUnderTestSkipFn(&env)). ... Extra changes: - Added helper skip func creators in the testhelper package for no CRDs, no statefulSets and no deployments found. - Adapted the observability ts.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
check.WithSkipFn(skipFunc)
has been replaced by a variadic func version to allow more than one skip functions to be called:check.WithSkipFn(skipFunc1, skipFunc2...)
By default, the check will be skipped if any skip function returns true when they're called (which happens before running the CheckFn).
If we need to skip the check in case all the skip functions return true, the check.WithSkipModeAll() needs to be used.
Examples:
testhelper.SkipIfEmptyAny()
):testhelper.SkipIfEmptyAll()
):The skip functions are appended to a slice in the same order as they're passed to the check.WithSkipCheckFn() calls, and it can be called more than once. E.g.: in the previous examples, this call:
is equal to:
Extra changes: