From 1f5b4b8802d49c08af673699324d0cb7835c4a19 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Thu, 24 Mar 2016 15:44:31 -0700 Subject: [PATCH] Address comments. --- pkg/master/master.go | 9 +++------ pkg/master/master_test.go | 9 ++++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/master/master.go b/pkg/master/master.go index 026369eeccb..cc23367757d 100644 --- a/pkg/master/master.go +++ b/pkg/master/master.go @@ -702,16 +702,13 @@ func (m *Master) getExtensionResources(c *Config) map[string]rest.Storage { master: m, thirdPartyResourceRegistry: thirdPartyResourceStorage, } - go func() { - wait.Forever(func() { - if m.disableThirdPartyControllerForTesting { - return - } + if !m.disableThirdPartyControllerForTesting { + go wait.Forever(func() { if err := thirdPartyControl.SyncResources(); err != nil { glog.Warningf("third party resource sync failed: %v", err) } }, 10*time.Second) - }() + } storage["thirdpartyresources"] = thirdPartyResourceStorage } diff --git a/pkg/master/master_test.go b/pkg/master/master_test.go index d43f3347e0a..c837858d664 100644 --- a/pkg/master/master_test.go +++ b/pkg/master/master_test.go @@ -97,8 +97,12 @@ func newMaster(t *testing.T) (*Master, *etcdtesting.EtcdTestServer, Config, *ass config.ProxyDialer = func(network, addr string) (net.Conn, error) { return nil, nil } config.ProxyTLSClientConfig = &tls.Config{} - // TODO: this is kind of hacky, make testing flakes go away even with - // the sync loop running. + // TODO: this is kind of hacky. The trouble is that the sync loop + // runs in a go-routine and there is no way to validate in the test + // that the sync routine has actually run. The right answer here + // is probably to add some sort of callback that we can register + // to validate that it's actually been run, but for now we don't + // run the sync routine and register types manually. config.disableThirdPartyControllerForTesting = true master, err := New(&config) @@ -484,7 +488,6 @@ func initThirdParty(t *testing.T, version string) (*Master, *etcdtesting.EtcdTes }, }, } - // master.thirdPartyStorage = etcdstorage.NewEtcdStorage(etcdserver.Client, testapi.Extensions.Codec(), etcdtest.PathPrefix(), false) _, master.ServiceClusterIPRange, _ = net.ParseCIDR("10.0.0.0/24") if !assert.NoError(master.InstallThirdPartyResource(api)) {