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

Remove unusued code and cleanup #520

Merged
merged 4 commits into from Mar 18, 2020

Conversation

alexander-demicev
Copy link
Contributor

This PR:

  1. Removes unused code
  2. Replaces unreasonable structures
  3. Removes duplicate imports
  4. Fixes t.Fatalf call from separate go routine

}
}()

err := <-errs
Copy link
Contributor

Choose a reason for hiding this comment

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

This will block until the channel receives anything (which in most cases would be never cause err == nil is normal?). Might be best to return this error channel as an extra param and then assign it to a var that can be checked in the AfterEach once stop has been closed, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea

@@ -59,7 +59,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
if configShallowCopy.Burst <= 0 {
return nil, fmt.Errorf("Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this not autogenerated code? Not sure this should be modified manually to fix linting errors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, it gets rewritten by make generate

@enxebre
Copy link
Member

enxebre commented Mar 18, 2020

thanks for the improvements! for the StartTestManager we should to align with other actuators and ginkgo in follow ups.
This PR would leave a fairly cleaner history if we split commits by the controllers they are changing.
/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enxebre

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 18, 2020
Comment on lines 71 to 73
if err := mgr.Start(stop); err != nil {
t.Fatalf("error starting test manager: %v", err)
errs <- err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I might suggest you just put this on the channel anyway, doesn't matter if it's a nil value or not, we can check that where it's being read. That way we can also guarantee that we check the error, as currently the select might not catch it in time

So it would look like here:

errs <- mgr.Start(stop)

and then

defer func() {
  if err := <-errChan; err != nil {
    t.Fatalf("error starting test manager: %v", err)
  }
}

Comment on lines 54 to 59
defer close(stop)
defer func() {
select {
case err := <-errChan:
if err != nil {
t.Fatalf("error starting test manager: %v", err)
}
default:
}
}()
Copy link
Contributor

Choose a reason for hiding this comment

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

This one needs updating to match the other one

Suggested change
defer close(stop)
defer func() {
select {
case err := <-errChan:
if err != nil {
t.Fatalf("error starting test manager: %v", err)
}
default:
}
}()
defer func() {
close(stop)
if err := <-errChan; err != nil {
t.Fatalf("error starting test manager: %v", err)
}
}()

@JoelSpeed
Copy link
Contributor

Once that last comment is fixed, I'm happy with this, @enxebre did you want the commits splitting to make the history cleaner?

@alexander-demicev
Copy link
Contributor Author

@JoelSpeed @enxebre All changes are separated by commits

@JoelSpeed
Copy link
Contributor

/lgtm

They seem sensible

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2020
@openshift-merge-robot openshift-merge-robot merged commit 391b15d into openshift:master Mar 18, 2020
@openshift-ci-robot
Copy link
Contributor

@alexander-demichev: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-aws-scaleup-rhel7 4c0c80c link /test e2e-aws-scaleup-rhel7
ci/prow/e2e-azure 4c0c80c link /test e2e-azure

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

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