@@ -753,18 +753,20 @@ func TestSetHasItemOrAll(t *testing.T) {
753
753
func TestImagePullCheck (t * testing.T ) {
754
754
fcmd := fakeexec.FakeCmd {
755
755
RunScript : []fakeexec.FakeRunAction {
756
- // Test case 1: img1 and img2 exist, img3 doesn't exist
756
+ // Test case 1: pull 3 images successfully
757
+ func () ([]byte , []byte , error ) { return nil , nil , nil },
757
758
func () ([]byte , []byte , error ) { return nil , nil , nil },
758
759
func () ([]byte , []byte , error ) { return nil , nil , nil },
759
- func () ([]byte , []byte , error ) { return nil , nil , & fakeexec.FakeExitError {Status : 1 } },
760
760
761
- // Test case 2: images don't exist
762
- func () ([]byte , []byte , error ) { return nil , nil , & fakeexec. FakeExitError { Status : 1 } },
761
+ // Test case 2: image pull errors
762
+ func () ([]byte , []byte , error ) { return nil , nil , nil },
763
763
func () ([]byte , []byte , error ) { return nil , nil , & fakeexec.FakeExitError {Status : 1 } },
764
764
func () ([]byte , []byte , error ) { return nil , nil , & fakeexec.FakeExitError {Status : 1 } },
765
765
},
766
766
CombinedOutputScript : []fakeexec.FakeCombinedOutputAction {
767
- // Test case1: pull only img3
767
+ // Test case1: pull 3 images
768
+ func () ([]byte , error ) { return nil , nil },
769
+ func () ([]byte , error ) { return nil , nil },
768
770
func () ([]byte , error ) { return nil , nil },
769
771
// Test case 2: fail to pull image2 and image3
770
772
func () ([]byte , error ) { return nil , nil },
@@ -781,10 +783,6 @@ func TestImagePullCheck(t *testing.T) {
781
783
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
782
784
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
783
785
func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
784
- func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
785
- func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
786
- func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
787
- func (cmd string , args ... string ) exec.Cmd { return fakeexec .InitFakeCmd (& fcmd , cmd , args ... ) },
788
786
},
789
787
LookPathFunc : func (cmd string ) (string , error ) { return "/usr/bin/docker" , nil },
790
788
}
@@ -803,7 +801,7 @@ func TestImagePullCheck(t *testing.T) {
803
801
t .Fatalf ("did not expect any warnings but got %q" , warnings )
804
802
}
805
803
if len (errors ) != 0 {
806
- t .Fatalf ("expected 1 errors but got %d: %q" , len (errors ), errors )
804
+ t .Fatalf ("expected 0 errors but got %d: %q" , len (errors ), errors )
807
805
}
808
806
809
807
warnings , errors = check .Check ()
0 commit comments