check_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. }
  50. func init() {
  51. check.Suite(&DockerTrustSuite{
  52. ds: &DockerSuite{},
  53. })
  54. }
  55. type DockerTrustSuite struct {
  56. ds *DockerSuite
  57. reg *testRegistryV2
  58. not *testNotary
  59. }
  60. func (s *DockerTrustSuite) SetUpTest(c *check.C) {
  61. s.reg = setupRegistry(c)
  62. s.not = setupNotary(c)
  63. }
  64. func (s *DockerTrustSuite) TearDownTest(c *check.C) {
  65. s.reg.Close()
  66. s.not.Close()
  67. s.ds.TearDownTest(c)
  68. }