-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Added empty actual value and expected value and non-empty flagName test #1517
Added empty actual value and expected value and non-empty flagName test #1517
Conversation
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.
@arjunkhunti-crest Could you please fix the e2e test? Thanks.
@@ -143,7 +143,11 @@ func (t flagTestItem) findValue(s string) (match bool, value string, err error) | |||
if strings.HasPrefix(t.Flag, "--") { | |||
value = "true" | |||
} else { | |||
value = vals[1] | |||
if t.Compare.Op == "eq" && !strings.Contains(t.Flag, ":") { |
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.
IMHO, adding a workaround code (!strings.Contains(t.Flag, ":")
) is not a good idea.
How about adding a new op like isempty
instead of changing the eq
op for your cases to support empty value?
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'm not familiar with the process of adding a new operation, and I'm thinking about closing this pull request. I'll communicate this process in the corresponding issue to encourage others to contribute instead.
As the suggested approach is different as implemented in this PR. Hence closing this PR. |
Kube-bench checks fail when the
flagVal
andcompareValue
are empty strings andflagName
is given. To resolve this, I have updated the code whereflagName
is assigned to thecompareVal
and added a test for the same.Expected Outcome
Actual Outcome