github.com/alexandrev/docker@v1.9.0/integration-cli/check_test.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/docker/docker/pkg/reexec" 8 "github.com/go-check/check" 9 ) 10 11 func Test(t *testing.T) { 12 reexec.Init() // This is required for external graphdriver tests 13 14 if !isLocalDaemon { 15 fmt.Println("INFO: Testing against a remote daemon") 16 } else { 17 fmt.Println("INFO: Testing against a local daemon") 18 } 19 20 check.TestingT(t) 21 } 22 23 func init() { 24 check.Suite(&DockerSuite{}) 25 } 26 27 type DockerSuite struct { 28 } 29 30 func (s *DockerSuite) TearDownTest(c *check.C) { 31 deleteAllContainers() 32 deleteAllImages() 33 deleteAllVolumes() 34 deleteAllNetworks() 35 } 36 37 func init() { 38 check.Suite(&DockerRegistrySuite{ 39 ds: &DockerSuite{}, 40 }) 41 } 42 43 type DockerRegistrySuite struct { 44 ds *DockerSuite 45 reg *testRegistryV2 46 d *Daemon 47 } 48 49 func (s *DockerRegistrySuite) SetUpTest(c *check.C) { 50 testRequires(c, DaemonIsLinux) 51 s.reg = setupRegistry(c) 52 s.d = NewDaemon(c) 53 } 54 55 func (s *DockerRegistrySuite) TearDownTest(c *check.C) { 56 if s.reg != nil { 57 s.reg.Close() 58 } 59 if s.ds != nil { 60 s.ds.TearDownTest(c) 61 } 62 s.d.Stop() 63 } 64 65 func init() { 66 check.Suite(&DockerDaemonSuite{ 67 ds: &DockerSuite{}, 68 }) 69 } 70 71 type DockerDaemonSuite struct { 72 ds *DockerSuite 73 d *Daemon 74 } 75 76 func (s *DockerDaemonSuite) SetUpTest(c *check.C) { 77 testRequires(c, DaemonIsLinux) 78 s.d = NewDaemon(c) 79 } 80 81 func (s *DockerDaemonSuite) TearDownTest(c *check.C) { 82 testRequires(c, DaemonIsLinux) 83 s.d.Stop() 84 s.ds.TearDownTest(c) 85 } 86 87 func init() { 88 check.Suite(&DockerTrustSuite{ 89 ds: &DockerSuite{}, 90 }) 91 } 92 93 type DockerTrustSuite struct { 94 ds *DockerSuite 95 reg *testRegistryV2 96 not *testNotary 97 } 98 99 func (s *DockerTrustSuite) SetUpTest(c *check.C) { 100 s.reg = setupRegistry(c) 101 s.not = setupNotary(c) 102 } 103 104 func (s *DockerTrustSuite) TearDownTest(c *check.C) { 105 s.reg.Close() 106 s.not.Close() 107 s.ds.TearDownTest(c) 108 }