@@ -23,7 +23,9 @@ func TestPullPushPrivateRepository(t *testing.T) {
2323 sourceImage := fixtures .AlpineImage
2424 privateImage := privateRegistryPrefix + "/private/alpine:test-private-pull-push"
2525
26- icmd .RunCommand ("docker" , "pull" , sourceImage ).Assert (t , icmd .Success )
26+ runWithPrivateRegistryRetry (t ,
27+ icmd .Command ("docker" , "pull" , sourceImage ),
28+ ).Assert (t , icmd .Success )
2729 t .Cleanup (func () {
2830 icmd .RunCommand ("docker" , "image" , "rm" , "-f" , privateImage ).Assert (t , icmd .Success )
2931 })
@@ -74,18 +76,20 @@ func assertAuthDenied(t *testing.T, result *icmd.Result) {
7476 )
7577}
7678
77- func runWithPrivateRegistryRetry (t * testing.T , cmd * icmd.Cmd , opts ... func ( * icmd.Cmd ) ) * icmd.Result {
79+ func runWithPrivateRegistryRetry (t * testing.T , cmd icmd.Cmd , opts ... icmd.CmdOp ) * icmd.Result {
7880 t .Helper ()
7981
80- deadline := time .Now ().Add (30 * time .Second )
82+ deadline := time .Now ().Add (60 * time .Second )
8183 for {
8284 result := icmd .RunCmd (cmd , opts ... )
8385 output := result .Combined ()
8486 if strings .Contains (output , "lookup private-registry" ) ||
87+ strings .Contains (output , "lookup registry" ) ||
8588 strings .Contains (output , "no such host" ) ||
86- strings .Contains (output , "server misbehaving" ) {
89+ strings .Contains (output , "server misbehaving" ) ||
90+ strings .Contains (output , "Temporary failure in name resolution" ) {
8791 if time .Now ().Before (deadline ) {
88- t .Logf ("waiting for private registry DNS to become available: %s" , output )
92+ t .Logf ("waiting for registry DNS to become available: %s" , output )
8993 time .Sleep (500 * time .Millisecond )
9094 continue
9195 }
0 commit comments