We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Adding a watch on channels, as mentioned in kubebuilder docs, on a fresh generated controller fails when running tests with the following error:
testing_t_support.go:22: /home/u/go/src/github.com/presslabs/mysql-operator/vendor/github.com/onsi/gomega/internal/assertion/assertion.go:69 +0x1ed github.com/presslabs/mysql-operator/vendor/github.com/onsi/gomega/internal/assertion.(*Assertion).NotTo(0xc42039ba40, 0x1332420, 0x1b92b68, 0x0, 0x0, 0x0, 0x1342260) /home/u/go/src/github.com/presslabs/mysql-operator/vendor/github.com/onsi/gomega/internal/assertion/assertion.go:43 +0xae github.com/presslabs/mysql-operator/pkg/controller/mysqlbackup.TestReconcile(0xc42010e1e0) /home/u/go/src/github.com/presslabs/mysql-operator/pkg/controller/mysqlbackup/mysqlbackup_controller_test.go:53 +0x2f5 testing.tRunner(0xc42010e1e0, 0x12ae268) /usr/local/go/src/testing/testing.go:777 +0xd0 created by testing.(*T).Run /usr/local/go/src/testing/testing.go:824 +0x2e0 Expected error: <*errors.errorString | 0xc4200bf5d0>: { s: "must call InjectStop on Channel before calling Start", } must call InjectStop on Channel before calling Start not to have occurred
The changes that I made to a fresh generated controller are:
diff --git a/pkg/controller/mysqlbackup/mysqlbackup_controller.go b/pkg/controller/mysqlbackup/mysqlbackup_controller.go index bebdfce8..7935c0fb 100644 --- a/pkg/controller/mysqlbackup/mysqlbackup_controller.go +++ b/pkg/controller/mysqlbackup/mysqlbackup_controller.go @@ -35,6 +35,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" + + "sigs.k8s.io/controller-runtime/pkg/event" ) /** @@ -78,6 +80,15 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { return err } + events := make(chan event.GenericEvent) + err = c.Watch( + &source.Channel{Source: events}, + &handler.EnqueueRequestForObject{}, + ) + if err != nil { + return err + } + return nil }
What happens:
Channel
The text was updated successfully, but these errors were encountered:
I will close it, it's a duplicate of #103
Sorry, something went wrong.
No branches or pull requests
Adding a watch on channels, as mentioned in kubebuilder docs, on a fresh generated controller fails when running tests with the following error:
The changes that I made to a fresh generated controller are:
What happens:
Channel
source is registered in the Watch method the stop channel is inserted but its inserts a nil channel.The text was updated successfully, but these errors were encountered: