@@ -454,7 +454,7 @@ type dockerBuild struct {
454454 Network string `yaml:"network,omitempty"`
455455}
456456
457- func testDockerMatrix (ctx context. Context , t * testing.T , d * dockerutil. Container ) {
457+ func testDockerMatrix (t * testing.T , overlay bool ) {
458458 definitions := []struct {
459459 name string
460460 testFunc func (ctx context.Context , t * testing.T , d * dockerutil.Container , opts dockerCommandOptions )
@@ -500,6 +500,10 @@ func testDockerMatrix(ctx context.Context, t *testing.T, d *dockerutil.Container
500500 }
501501 name := strings .Join (nameParts , "_" )
502502 t .Run (name , func (t * testing.T ) {
503+ ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Minute )
504+ defer cancel ()
505+ d := startDockerdInGvisor (ctx , t , overlay )
506+ defer d .CleanUp (ctx )
503507 if err := backoff .Retry (func () error {
504508 output , err := dockerInGvisorExecOutput (ctx , d , []string {"docker" , "info" })
505509 if err != nil {
@@ -509,7 +513,7 @@ func testDockerMatrix(ctx context.Context, t *testing.T, d *dockerutil.Container
509513 return nil
510514 }
511515 return fmt .Errorf ("docker daemon not ready" )
512- }, backoff .WithMaxRetries (backoff .NewConstantBackOff (100 * time .Millisecond ), 10 )); err != nil {
516+ }, backoff .WithMaxRetries (backoff .NewConstantBackOff (1 * time .Second ), 10 )); err != nil {
513517 t .Fatalf ("failed to run docker test %q: %v" , name , err )
514518 }
515519 def .testFunc (ctx , t , d , opts )
@@ -523,20 +527,14 @@ func TestDockerWithVFS(t *testing.T) {
523527 if testutil .IsRunningWithHostNet () {
524528 t .Skip ("docker doesn't work with hostinet" )
525529 }
526- ctx := context .Background ()
527- d := startDockerdInGvisor (ctx , t , false )
528- defer d .CleanUp (ctx )
529- testDockerMatrix (ctx , t , d )
530+ testDockerMatrix (t , false )
530531}
531532
532533func TestDockerWithOverlay (t * testing.T ) {
533534 if testutil .IsRunningWithHostNet () {
534535 t .Skip ("docker doesn't work with hostinet" )
535536 }
536- ctx := context .Background ()
537- d := startDockerdInGvisor (ctx , t , true )
538- defer d .CleanUp (ctx )
539- testDockerMatrix (ctx , t , d )
537+ testDockerMatrix (t , true )
540538}
541539
542540// The container returned by this function has to be cleaned up by the caller.
@@ -714,6 +712,9 @@ func testDockerComposeBuild(ctx context.Context, t *testing.T, d *dockerutil.Con
714712 network := ""
715713 if opts .hostNetwork {
716714 network = "host"
715+ } else {
716+ // TODO(b/447472587): re-enable bridge network test.
717+ t .Skip ("Skip docker compose build test with bridge network." )
717718 }
718719 config := dockerComposeConfig {
719720 Name : "image_test" ,
0 commit comments