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
Read default regexes from configmap for tests. #1548
Read default regexes from configmap for tests. #1548
Conversation
// buildRegexConfigMap reads the install log regexes configmap from within config/configmaps/install-log-regexes-configmap.yaml | ||
func buildRegexConfigMap() runtime.Object { | ||
decode := serializer.NewCodecFactory(scheme.Scheme).UniversalDeserializer().Decode | ||
stream, err := ioutil.ReadFile("../../../config/configmaps/install-log-regexes-configmap.yaml") |
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.
Let's bindata this puppy.
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.
Oh, look, it already is.
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.
To be clear, I'm asking you to use the bindata asset instead of loading up the file "by hand" here.
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.
bindata means we need to make update every time and it's not always clear why my changes do not come up. since go test runs from the source code directly, it's imo better to use the file directly.
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.
Our verify
CI test already enforces that bindata is in sync.
This is what bindata is for.
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 could see the workflow of adding a new regex/test being a little confusing if you have to make bindata before running this test specifically. I click run test in vscode a lot.
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.
Fair enough.
Codecov Report
@@ Coverage Diff @@
## master #1548 +/- ##
==========================================
+ Coverage 41.50% 41.56% +0.06%
==========================================
Files 336 336
Lines 30691 30885 +194
==========================================
+ Hits 12737 12837 +100
- Misses 16867 16956 +89
- Partials 1087 1092 +5
|
/hold cancel |
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.
There are several other test cases with inlined configmaps. If those regexes aren't part of the official config, do we still need to test them?
}}, | ||
name: "GCP compute quota", | ||
log: pointer.StringPtr(gcpCPUQuotaLog), | ||
existing: []runtime.Object{buildRegexConfigMap()}, |
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 is latent, so could be handled in a separate PR, but is there any reason to build this on every test case? It's read-only, right?
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.
There are some test cases that want a missing config or a malformed regex so that's why I have it per test case atm.
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.
Could split them in a separate PR
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.
some test cases that want a missing config or a malformed regex
So there are two different issues here.
- This comment was about all test cases where
existing
is simply usingbuildRegexConfigMap()
. All of those test cases should be able to reuse a common variable built once at the top of the function. That's the bit I'm saying was latent and could be handled in a separate PR. - Some of the test cases don't use
buildRegexConfigMap()
but instead use inlined configmaps. Are all of those specifically testing edge cases with missing/bad configmaps?
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.
In any case, this is a good start. We can address further cleanup in subsequent PRs.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 2uasimojo, abutcher 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 |
/unhold |
/test e2e-pool |
@yithian @gregsheremeta
/hold