github.com/slowteetoe/docker@v1.7.1-rc3/integration-cli/check_test.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  	"time"
     7  
     8  	"github.com/go-check/check"
     9  )
    10  
    11  func Test(t *testing.T) {
    12  	check.TestingT(t)
    13  }
    14  
    15  type TimerSuite struct {
    16  	start time.Time
    17  }
    18  
    19  func (s *TimerSuite) SetUpTest(c *check.C) {
    20  	s.start = time.Now()
    21  }
    22  
    23  func (s *TimerSuite) TearDownTest(c *check.C) {
    24  	fmt.Printf("%-60s%.2f\n", c.TestName(), time.Since(s.start).Seconds())
    25  }
    26  
    27  func init() {
    28  	check.Suite(&DockerSuite{})
    29  }
    30  
    31  type DockerSuite struct {
    32  	TimerSuite
    33  }
    34  
    35  func (s *DockerSuite) TearDownTest(c *check.C) {
    36  	deleteAllContainers()
    37  	deleteAllImages()
    38  	s.TimerSuite.TearDownTest(c)
    39  }
    40  
    41  func init() {
    42  	check.Suite(&DockerRegistrySuite{
    43  		ds: &DockerSuite{},
    44  	})
    45  }
    46  
    47  type DockerRegistrySuite struct {
    48  	ds  *DockerSuite
    49  	reg *testRegistryV2
    50  }
    51  
    52  func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
    53  	s.reg = setupRegistry(c)
    54  	s.ds.SetUpTest(c)
    55  }
    56  
    57  func (s *DockerRegistrySuite) TearDownTest(c *check.C) {
    58  	s.reg.Close()
    59  	s.ds.TearDownTest(c)
    60  }
    61  
    62  func init() {
    63  	check.Suite(&DockerDaemonSuite{
    64  		ds: &DockerSuite{},
    65  	})
    66  }
    67  
    68  type DockerDaemonSuite struct {
    69  	ds *DockerSuite
    70  	d  *Daemon
    71  }
    72  
    73  func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
    74  	s.d = NewDaemon(c)
    75  	s.ds.SetUpTest(c)
    76  }
    77  
    78  func (s *DockerDaemonSuite) TearDownTest(c *check.C) {
    79  	s.d.Stop()
    80  	s.ds.TearDownTest(c)
    81  }