Exit from NewController() for PersistentVolumeController when InitPlugins() failed just like NewAttachDetachController() does

This commit is contained in:
NickrenREN
2017-03-13 15:41:59 +08:00
parent ceccd305ce
commit e0ef5bfd40
6 changed files with 38 additions and 15 deletions

View File

@@ -172,7 +172,10 @@ func TestControllerSync(t *testing.T) {
client.PrependWatchReactor("storageclasses", core.DefaultWatchReactor(watch.NewFake(), nil))
informers := informers.NewSharedInformerFactory(client, controller.NoResyncPeriodFunc())
ctrl := newTestController(client, informers, true)
ctrl, err := newTestController(client, informers, true)
if err != nil {
t.Fatalf("Test %q construct persistent volume failed: %v", test.name, err)
}
reactor := newVolumeReactor(client, ctrl, fakeVolumeWatch, fakeClaimWatch, test.errors)
for _, claim := range test.initialClaims {
@@ -204,7 +207,7 @@ func TestControllerSync(t *testing.T) {
glog.V(4).Infof("controller synced, starting test")
// Call the tested function
err := test.test(ctrl, reactor, test)
err = test.test(ctrl, reactor, test)
if err != nil {
t.Errorf("Test %q initial test call failed: %v", test.name, err)
}