-
Notifications
You must be signed in to change notification settings - Fork 1.2k
🐛 InformerCache: Do not require leader lease #678
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cache_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
"k8s.io/client-go/rest" | ||
|
||
"sigs.k8s.io/controller-runtime/pkg/cache" | ||
"sigs.k8s.io/controller-runtime/pkg/client/apiutil" | ||
"sigs.k8s.io/controller-runtime/pkg/manager" | ||
) | ||
|
||
var _ = Describe("informerCache", func() { | ||
It("should not require LeaderElection", func() { | ||
cfg := &rest.Config{} | ||
|
||
mapper, err := apiutil.NewDynamicRESTMapper(cfg, apiutil.WithLazyDiscovery) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
c, err := cache.New(cfg, cache.Options{Mapper: mapper}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't find a matcher for "type X implements interface Y", the closed to that I found is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is clear enough. If you're really worried, you can always add an explanation after the "be true" part as a format string, but I think this is readable enough for now. |
||
|
||
leaderElectionRunnable, ok := c.(manager.LeaderElectionRunnable) | ||
Expect(ok).To(BeTrue()) | ||
Expect(leaderElectionRunnable.NeedLeaderElection()).To(BeFalse()) | ||
}) | ||
}) |
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.
Unfortunately we can not verify the interface implementation via a
var _ manager.LeaderElectionRunnable = &informerCache{}
as that would result in an import cycle