github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/integration/plugin/common/main_test.go (about) 1 package common // import "github.com/docker/docker/integration/plugin/common" 2 3 import ( 4 "fmt" 5 "os" 6 "testing" 7 8 "github.com/docker/docker/pkg/reexec" 9 "github.com/docker/docker/testutil/environment" 10 ) 11 12 var testEnv *environment.Execution 13 14 func TestMain(m *testing.M) { 15 if reexec.Init() { 16 return 17 } 18 var err error 19 testEnv, err = environment.New() 20 if err != nil { 21 fmt.Println(err) 22 os.Exit(1) 23 } 24 testEnv.Print() 25 os.Exit(m.Run()) 26 } 27 28 func setupTest(t *testing.T) func() { 29 environment.ProtectAll(t, testEnv) 30 return func() { testEnv.Clean(t) } 31 }