fed: Fix flakey ingress unit test

The unit test for the ingress controller was previously adding
a cluster twice, which resulted in a cluster being deleted and added
back.  The deletion was racing the controller shutdown to close
informer channels.  This change ensures that the informer clears its
map of informers when Stop() is called to prevent a double close, and
that the test no longer adds the cluster twice.
This commit is contained in:
Maru Newby
2017-03-13 12:50:35 -07:00
parent ab9b299c30
commit 02a294533b
2 changed files with 5 additions and 5 deletions

View File

@@ -281,6 +281,10 @@ func (f *federatedInformerImpl) Stop() {
for key, informer := range f.targetInformers {
glog.V(4).Infof("... Closing informer channel for %q.", key)
close(informer.stopChan)
// Remove each informer after it has been stopped to prevent
// subsequent cluster deletion from attempting to double close
// an informer's stop channel.
delete(f.targetInformers, key)
}
}