github.com/darciopacifico/docker@v1.9.0-rc1/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  }
    35  
    36  func init() {
    37  	check.Suite(&DockerRegistrySuite{
    38  		ds: &DockerSuite{},
    39  	})
    40  }
    41  
    42  type DockerRegistrySuite struct {
    43  	ds  *DockerSuite
    44  	reg *testRegistryV2
    45  	d   *Daemon
    46  }
    47  
    48  func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
    49  	testRequires(c, DaemonIsLinux)
    50  	s.reg = setupRegistry(c)
    51  	s.d = NewDaemon(c)
    52  }
    53  
    54  func (s *DockerRegistrySuite) TearDownTest(c *check.C) {
    55  	if s.reg != nil {
    56  		s.reg.Close()
    57  	}
    58  	if s.ds != nil {
    59  		s.ds.TearDownTest(c)
    60  	}
    61  	s.d.Stop()
    62  }
    63  
    64  func init() {
    65  	check.Suite(&DockerDaemonSuite{
    66  		ds: &DockerSuite{},
    67  	})
    68  }
    69  
    70  type DockerDaemonSuite struct {
    71  	ds *DockerSuite
    72  	d  *Daemon
    73  }
    74  
    75  func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
    76  	testRequires(c, DaemonIsLinux)
    77  	s.d = NewDaemon(c)
    78  }
    79  
    80  func (s *DockerDaemonSuite) TearDownTest(c *check.C) {
    81  	testRequires(c, DaemonIsLinux)
    82  	s.d.Stop()
    83  	s.ds.TearDownTest(c)
    84  }
    85  
    86  func init() {
    87  	check.Suite(&DockerTrustSuite{
    88  		ds: &DockerSuite{},
    89  	})
    90  }
    91  
    92  type DockerTrustSuite struct {
    93  	ds  *DockerSuite
    94  	reg *testRegistryV2
    95  	not *testNotary
    96  }
    97  
    98  func (s *DockerTrustSuite) SetUpTest(c *check.C) {
    99  	s.reg = setupRegistry(c)
   100  	s.not = setupNotary(c)
   101  }
   102  
   103  func (s *DockerTrustSuite) TearDownTest(c *check.C) {
   104  	s.reg.Close()
   105  	s.not.Close()
   106  	s.ds.TearDownTest(c)
   107  }