main_test.go 553 B

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