Fix deployment unit test by adding a dummy update reactor

This commit is contained in:
nikhiljindal
2017-02-03 12:16:13 -08:00
parent 64643c6582
commit 740aa93838
3 changed files with 19 additions and 2 deletions

View File

@@ -85,6 +85,9 @@ func TestDeploymentController(t *testing.T) {
cluster2 := NewCluster("cluster2", apiv1.ConditionTrue)
fakeClient := &fakefedclientset.Clientset{}
// Add an update reactor on fake client to return the desired updated object.
// This is a hack to workaround https://github.com/kubernetes/kubernetes/issues/40939.
AddFakeUpdateReactor("deployments", &fakeClient.Fake)
RegisterFakeList("clusters", &fakeClient.Fake, &fedv1.ClusterList{Items: []fedv1.Cluster{*cluster1}})
deploymentsWatch := RegisterFakeWatch("deployments", &fakeClient.Fake)
clusterWatch := RegisterFakeWatch("clusters", &fakeClient.Fake)