github.com/endocode/docker@v1.4.2-0.20160113120958-46eb4700391e/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  	unpauseAllContainers()
    32  	deleteAllContainers()
    33  	deleteAllImages()
    34  	deleteAllVolumes()
    35  	deleteAllNetworks()
    36  }
    37  
    38  func init() {
    39  	check.Suite(&DockerRegistrySuite{
    40  		ds: &DockerSuite{},
    41  	})
    42  }
    43  
    44  type DockerRegistrySuite struct {
    45  	ds  *DockerSuite
    46  	reg *testRegistryV2
    47  	d   *Daemon
    48  }
    49  
    50  func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
    51  	testRequires(c, DaemonIsLinux)
    52  	s.reg = setupRegistry(c, false)
    53  	s.d = NewDaemon(c)
    54  }
    55  
    56  func (s *DockerRegistrySuite) TearDownTest(c *check.C) {
    57  	if s.reg != nil {
    58  		s.reg.Close()
    59  	}
    60  	if s.ds != nil {
    61  		s.ds.TearDownTest(c)
    62  	}
    63  	s.d.Stop()
    64  }
    65  
    66  func init() {
    67  	check.Suite(&DockerSchema1RegistrySuite{
    68  		ds: &DockerSuite{},
    69  	})
    70  }
    71  
    72  type DockerSchema1RegistrySuite struct {
    73  	ds  *DockerSuite
    74  	reg *testRegistryV2
    75  	d   *Daemon
    76  }
    77  
    78  func (s *DockerSchema1RegistrySuite) SetUpTest(c *check.C) {
    79  	testRequires(c, DaemonIsLinux)
    80  	s.reg = setupRegistry(c, true)
    81  	s.d = NewDaemon(c)
    82  }
    83  
    84  func (s *DockerSchema1RegistrySuite) TearDownTest(c *check.C) {
    85  	if s.reg != nil {
    86  		s.reg.Close()
    87  	}
    88  	if s.ds != nil {
    89  		s.ds.TearDownTest(c)
    90  	}
    91  	s.d.Stop()
    92  }
    93  
    94  func init() {
    95  	check.Suite(&DockerDaemonSuite{
    96  		ds: &DockerSuite{},
    97  	})
    98  }
    99  
   100  type DockerDaemonSuite struct {
   101  	ds *DockerSuite
   102  	d  *Daemon
   103  }
   104  
   105  func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
   106  	testRequires(c, DaemonIsLinux)
   107  	s.d = NewDaemon(c)
   108  }
   109  
   110  func (s *DockerDaemonSuite) TearDownTest(c *check.C) {
   111  	testRequires(c, DaemonIsLinux)
   112  	s.d.Stop()
   113  	s.ds.TearDownTest(c)
   114  }
   115  
   116  func init() {
   117  	check.Suite(&DockerTrustSuite{
   118  		ds: &DockerSuite{},
   119  	})
   120  }
   121  
   122  type DockerTrustSuite struct {
   123  	ds  *DockerSuite
   124  	reg *testRegistryV2
   125  	not *testNotary
   126  }
   127  
   128  func (s *DockerTrustSuite) SetUpTest(c *check.C) {
   129  	s.reg = setupRegistry(c, false)
   130  	s.not = setupNotary(c)
   131  }
   132  
   133  func (s *DockerTrustSuite) TearDownTest(c *check.C) {
   134  	s.reg.Close()
   135  	s.not.Close()
   136  	s.ds.TearDownTest(c)
   137  }