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