check_test.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. if s.reg != nil {
  32. s.reg.Close()
  33. }
  34. if s.ds != nil {
  35. s.ds.TearDownTest(c)
  36. }
  37. }
  38. func init() {
  39. check.Suite(&DockerDaemonSuite{
  40. ds: &DockerSuite{},
  41. })
  42. }
  43. type DockerDaemonSuite struct {
  44. ds *DockerSuite
  45. d *Daemon
  46. }
  47. func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
  48. s.d = NewDaemon(c)
  49. }
  50. func (s *DockerDaemonSuite) TearDownTest(c *check.C) {
  51. s.d.Stop()
  52. s.ds.TearDownTest(c)
  53. }
  54. func init() {
  55. check.Suite(&DockerTrustSuite{
  56. ds: &DockerSuite{},
  57. })
  58. }
  59. type DockerTrustSuite struct {
  60. ds *DockerSuite
  61. reg *testRegistryV2
  62. not *testNotary
  63. }
  64. func (s *DockerTrustSuite) SetUpTest(c *check.C) {
  65. s.reg = setupRegistry(c)
  66. s.not = setupNotary(c)
  67. }
  68. func (s *DockerTrustSuite) TearDownTest(c *check.C) {
  69. s.reg.Close()
  70. s.not.Close()
  71. s.ds.TearDownTest(c)
  72. }