@@ -913,42 +913,42 @@ func TestImagePullDiagnosis(t *testing.T) {
913913 reason string
914914 message string
915915 wantCause string
916- wantAct string
916+ wantActs [] string
917917 }{
918918 {
919919 name : "not found" ,
920920 reason : "ImagePullBackOff" ,
921921 message : `Back-off pulling image "reg.io/team/api:v2": failed to resolve reference "reg.io/team/api:v2": not found` ,
922922 wantCause : "Image not found: reg.io/team/api:v2" ,
923- wantAct : "repository and tag" ,
923+ wantActs : [] string { "repository and tag" } ,
924924 },
925925 {
926926 name : "auth wins over not found" ,
927927 reason : "ErrImagePull" ,
928928 message : `failed to pull image "priv.io/app:v1": not found: authentication required` ,
929929 wantCause : "Not authorized to pull image: priv.io/app:v1" ,
930- wantAct : "imagePullSecrets" ,
930+ wantActs : [] string { "imagePullSecrets" , "repository/tag" } ,
931931 },
932932 {
933933 name : "registry unreachable" ,
934934 reason : "ImagePullBackOff" ,
935935 message : `failed to pull image "reg.io/app:v1": dial tcp: lookup reg.io: no such host` ,
936936 wantCause : "Registry unreachable: reg.io/app:v1" ,
937- wantAct : "DNS" ,
937+ wantActs : [] string { "DNS" } ,
938938 },
939939 {
940940 name : "rate limited" ,
941941 reason : "ImagePullBackOff" ,
942942 message : `toomanyrequests: rate limit exceeded for image "reg.io/app:v1"` ,
943943 wantCause : "Registry rate-limited: reg.io/app:v1" ,
944- wantAct : "authenticated" ,
944+ wantActs : [] string { "authenticated" } ,
945945 },
946946 {
947947 name : "invalid reference" ,
948948 reason : "InvalidImageName" ,
949949 message : `Failed to apply default image tag "bad image": invalid reference format` ,
950950 wantCause : "Image reference is invalid" ,
951- wantAct : "syntax" ,
951+ wantActs : [] string { "syntax" } ,
952952 },
953953 {
954954 name : "unknown shape" ,
@@ -972,14 +972,16 @@ func TestImagePullDiagnosis(t *testing.T) {
972972 if cause != tc .wantCause {
973973 t .Fatalf ("cause = %q, want %q" , cause , tc .wantCause )
974974 }
975- if tc .wantAct == "" {
975+ if len ( tc .wantActs ) == 0 {
976976 if action != "" {
977977 t .Fatalf ("action = %q, want empty" , action )
978978 }
979979 return
980980 }
981- if ! strings .Contains (action , tc .wantAct ) {
982- t .Fatalf ("action = %q, want substring %q" , action , tc .wantAct )
981+ for _ , wantAct := range tc .wantActs {
982+ if ! strings .Contains (action , wantAct ) {
983+ t .Fatalf ("action = %q, want substring %q" , action , wantAct )
984+ }
983985 }
984986 })
985987 }
0 commit comments