-
Notifications
You must be signed in to change notification settings - Fork 19
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
Adding test for network policy regex #517
base: master
Are you sure you want to change the base?
Adding test for network policy regex #517
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Vincent056 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 |
tests/e2e/serial/main_test.go
Outdated
}, | ||
SetValues: []compv1alpha1.VariableValueSpec{ | ||
{ | ||
Name: "ocp4-var-network-policies-namespaces-whitelist-regex", |
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.
This test depends on certain variables and rules being available in the content.
Can we or should we add conditionals?
For example, only run this test if both the rule and the variable exist.
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.
I think that's a good idea!
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.
I was investigating on this, found out that tailoredprofile will error out if we can't find the variable
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.
@Vincent056 Resulting in error is fine when creating a TP with a variable that doesn't exist.
But the point of this test is to ensure that the regex works, not that the rule and variable are present in the content, right?
So if for some reason the rule or variable are deprecated or missing, this test will error and block CI. And in this situation I think the test should just be skipped.
2af02ae
to
ad58969
Compare
ad58969
to
e071a5b
Compare
/retest |
Added e2e test for configure-network-policies-namespaces rule, test if whitelist-regex works as expected
e071a5b
to
5e89f7d
Compare
|
||
err = f.AssertVariableExists(variableName, f.OperatorNamespace) | ||
if err != nil { | ||
t.Fatal(err) |
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.
I think we should skip here
t.Fatal(err) | |
t.Skip("Content doesn't have variable '%s' required for testing", variableName) | |
return |
Added e2e test for configure-network-policies-namespaces rule, test if whitelist-regex works as expected.
This works in-conjunction with ComplianceAsCode/content#11952