check_test.go 924 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package main
  2. import (
  3. "testing"
  4. "github.com/go-check/check"
  5. )
  6. func Test(t *testing.T) {
  7. check.TestingT(t)
  8. }
  9. func init() {
  10. check.Suite(&DockerSuite{})
  11. }
  12. type DockerSuite struct {
  13. }
  14. func (s *DockerSuite) TearDownTest(c *check.C) {
  15. deleteAllContainers()
  16. deleteAllImages()
  17. }
  18. func init() {
  19. check.Suite(&DockerRegistrySuite{
  20. ds: &DockerSuite{},
  21. })
  22. }
  23. type DockerRegistrySuite struct {
  24. ds *DockerSuite
  25. reg *testRegistryV2
  26. }
  27. func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
  28. s.reg = setupRegistry(c)
  29. }
  30. func (s *DockerRegistrySuite) TearDownTest(c *check.C) {
  31. s.reg.Close()
  32. s.ds.TearDownTest(c)
  33. }
  34. func init() {
  35. check.Suite(&DockerDaemonSuite{
  36. ds: &DockerSuite{},
  37. })
  38. }
  39. type DockerDaemonSuite struct {
  40. ds *DockerSuite
  41. d *Daemon
  42. }
  43. func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
  44. s.d = NewDaemon(c)
  45. }
  46. func (s *DockerDaemonSuite) TearDownTest(c *check.C) {
  47. s.d.Stop()
  48. s.ds.TearDownTest(c)
  49. }