github.com/getsynq/migrate/v4@v4.15.3-0.20220615182648-8e72daaa5ed9/dktesting/example_test.go (about)

     1  package dktesting_test
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/dhui/dktest"
     8  	"github.com/getsynq/migrate/v4/dktesting"
     9  )
    10  
    11  func ExampleParallelTest() {
    12  	t := &testing.T{} // Should actually be used in a Test
    13  
    14  	var isReady = func(ctx context.Context, c dktest.ContainerInfo) bool {
    15  		// Return true if the container is ready to run tests.
    16  		// Don't block here though. Use the Context to timeout container ready checks.
    17  		return true
    18  	}
    19  
    20  	dktesting.ParallelTest(t, []dktesting.ContainerSpec{{ImageName: "docker_image:9.6",
    21  		Options: dktest.Options{ReadyFunc: isReady}}}, func(t *testing.T, c dktest.ContainerInfo) {
    22  		// Run your test/s ...
    23  		t.Fatal("...")
    24  	})
    25  }