Skip to content
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

Merged

Conversation

abutcher
Copy link
Member

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 23, 2021
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 23, 2021
// 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")
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Member Author

@abutcher abutcher Sep 24, 2021

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

@codecov
Copy link

codecov bot commented Sep 24, 2021

Codecov Report

Merging #1548 (b67dcd1) into master (22c6da1) will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
pkg/operator/assets/bindata.go 0.00% <0.00%> (ø)
pkg/controller/dnszone/dnszone_controller.go 28.88% <0.00%> (ø)
...b.com/openshift/hive/apis/hive/v1/dnszone_types.go 100.00% <0.00%> (ø)
...m/openshift/hive/apis/hive/v1/clusterpool_types.go 100.00% <0.00%> (ø)
...shift/hive/apis/hive/v1/clusterdeployment_types.go 100.00% <0.00%> (ø)
pkg/test/clusterdeployment/clusterdeployment.go 96.66% <0.00%> (+0.07%) ⬆️
pkg/test/clusterpool/clusterpool.go 97.53% <0.00%> (+0.09%) ⬆️
...g/controller/hibernation/hibernation_controller.go 59.58% <0.00%> (+0.13%) ⬆️
.../clusterdeployment/clusterdeployment_controller.go 59.83% <0.00%> (+0.14%) ⬆️
pkg/controller/clusterpool/collections.go 76.88% <0.00%> (+0.27%) ⬆️
... and 3 more

@abutcher
Copy link
Member Author

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 24, 2021
Copy link
Member

@2uasimojo 2uasimojo left a 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()},
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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

Copy link
Member

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.

  1. This comment was about all test cases where existing is simply using buildRegexConfigMap(). 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.
  2. 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?

@abutcher
Copy link
Member Author

If this goes before #1539 @yithian will have to rebase again so
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 24, 2021
Copy link
Member

@2uasimojo 2uasimojo left a 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

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 24, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 24, 2021

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gregsheremeta
Copy link
Contributor

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 28, 2021
@2uasimojo
Copy link
Member

/test e2e-pool

@openshift-merge-robot openshift-merge-robot merged commit e1182a0 into openshift:master Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants