diff --git a/discovery/fake/BUILD b/discovery/fake/BUILD index ac28a224..f4ef7d21 100644 --- a/discovery/fake/BUILD +++ b/discovery/fake/BUILD @@ -30,6 +30,9 @@ filegroup( filegroup( name = "all-srcs", - srcs = [":package-srcs"], + srcs = [ + ":package-srcs", + "//staging/src/k8s.io/client-go/discovery/fake/test:all-srcs", + ], tags = ["automanaged"], ) diff --git a/discovery/fake/test/BUILD b/discovery/fake/test/BUILD new file mode 100644 index 00000000..eb19f919 --- /dev/null +++ b/discovery/fake/test/BUILD @@ -0,0 +1,25 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_test") + +go_test( + name = "go_default_test", + srcs = ["discovery_test.go"], + deps = [ + "//vendor/k8s.io/apimachinery/pkg/version:go_default_library", + "//vendor/k8s.io/client-go/discovery/fake:go_default_library", + "//vendor/k8s.io/client-go/kubernetes/fake:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/kubernetes/fake/clientset_generated.go b/kubernetes/fake/clientset_generated.go index 5569e92b..22937cce 100644 --- a/kubernetes/fake/clientset_generated.go +++ b/kubernetes/fake/clientset_generated.go @@ -87,10 +87,9 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset { fakePtr := testing.Fake{} fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) - fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) - return &Clientset{fakePtr} + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} } // Clientset implements clientset.Interface. Meant to be embedded into a @@ -98,10 +97,11 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset { // you want to test easier. type Clientset struct { testing.Fake + discovery *fakediscovery.FakeDiscovery } func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return &fakediscovery.FakeDiscovery{Fake: &c.Fake} + return c.discovery } var _ clientset.Interface = &Clientset{}