Skip to content

Bug in manager_test #429

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

Closed
mengqiy opened this issue May 14, 2019 · 8 comments
Closed

Bug in manager_test #429

mengqiy opened this issue May 14, 2019 · 8 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@mengqiy
Copy link
Member

mengqiy commented May 14, 2019

/kind bug

It("should return an error if any Components fail to Start", func(done Done) {
m, err := New(cfg, options)
Expect(err).NotTo(HaveOccurred())
c1 := make(chan struct{})
Expect(m.Add(RunnableFunc(func(s <-chan struct{}) error {
defer GinkgoRecover()
defer close(c1)
return nil
}))).To(Succeed())
c2 := make(chan struct{})
Expect(m.Add(RunnableFunc(func(s <-chan struct{}) error {
defer GinkgoRecover()
defer close(c2)
return fmt.Errorf("expected error")
}))).To(Succeed())
c3 := make(chan struct{})
Expect(m.Add(RunnableFunc(func(s <-chan struct{}) error {
defer GinkgoRecover()
defer close(c3)
return nil
}))).To(Succeed())
go func() {
defer GinkgoRecover()
Expect(m.Start(stop)).NotTo(HaveOccurred())
close(done)
}()
<-c1
<-c2
<-c3
})

This piece of code should expect an error in the end but actually it's not.

This test case should not panic, it should not use GinkgoRecover.

Probably there is a bug in the test.

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label May 14, 2019
@mengqiy
Copy link
Member Author

mengqiy commented May 14, 2019

cc: @droot @DirectXMan12

@DirectXMan12
Copy link
Contributor

You almost always want to use GinkgoRecover when spawing goroutines (which a runnable is), and just about anything can panic (yay side effects not captured by the type system). In this case, for instance, if that channel is somehow nil, the test could panic.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 2, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 2, 2019
@mengqiy mengqiy removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Oct 2, 2019
dbenque added a commit to DataDog/controller-runtime that referenced this issue Oct 28, 2019
dbenque added a commit to DataDog/controller-runtime that referenced this issue Oct 29, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 31, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 30, 2020
DirectXMan12 pushed a commit that referenced this issue Jan 31, 2020
@vincepri vincepri removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Feb 20, 2020
@vincepri
Copy link
Member

Closing in favor of #764

/close

@k8s-ci-robot
Copy link
Contributor

@vincepri: Closing this issue.

In response to this:

Closing in favor of #764

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

5 participants