2015-04-18 12:46:47 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-06-05 16:09:53 -04:00
|
|
|
"fmt"
|
2015-04-18 12:46:47 -04:00
|
|
|
"testing"
|
|
|
|
|
2015-06-05 16:09:53 -04:00
|
|
|
"github.com/docker/docker/pkg/reexec"
|
2015-04-18 12:46:47 -04:00
|
|
|
"github.com/go-check/check"
|
|
|
|
)
|
|
|
|
|
2015-04-22 14:20:32 -04:00
|
|
|
func Test(t *testing.T) {
|
2015-06-05 16:09:53 -04:00
|
|
|
reexec.Init() // This is required for external graphdriver tests
|
|
|
|
|
|
|
|
if !isLocalDaemon {
|
|
|
|
fmt.Println("INFO: Testing against a remote daemon")
|
|
|
|
} else {
|
|
|
|
fmt.Println("INFO: Testing against a local daemon")
|
|
|
|
}
|
|
|
|
|
2015-04-22 14:20:32 -04:00
|
|
|
check.TestingT(t)
|
|
|
|
}
|
2015-04-18 12:46:47 -04:00
|
|
|
|
2015-04-24 17:16:56 -04:00
|
|
|
func init() {
|
|
|
|
check.Suite(&DockerSuite{})
|
|
|
|
}
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
type DockerSuite struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSuite) TearDownTest(c *check.C) {
|
|
|
|
deleteAllContainers()
|
2015-04-23 17:39:31 -04:00
|
|
|
deleteAllImages()
|
2015-06-12 09:25:32 -04:00
|
|
|
deleteAllVolumes()
|
2015-10-13 17:18:05 -04:00
|
|
|
deleteAllNetworks()
|
2015-04-18 12:46:47 -04:00
|
|
|
}
|
|
|
|
|
2015-04-24 17:16:56 -04:00
|
|
|
func init() {
|
|
|
|
check.Suite(&DockerRegistrySuite{
|
|
|
|
ds: &DockerSuite{},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
type DockerRegistrySuite struct {
|
|
|
|
ds *DockerSuite
|
|
|
|
reg *testRegistryV2
|
2015-09-16 13:42:17 -04:00
|
|
|
d *Daemon
|
2015-04-24 17:16:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
|
2015-09-16 13:42:17 -04:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-04-24 17:16:56 -04:00
|
|
|
s.reg = setupRegistry(c)
|
2015-09-16 13:42:17 -04:00
|
|
|
s.d = NewDaemon(c)
|
2015-04-24 17:16:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerRegistrySuite) TearDownTest(c *check.C) {
|
2015-07-23 05:40:54 -04:00
|
|
|
if s.reg != nil {
|
|
|
|
s.reg.Close()
|
|
|
|
}
|
|
|
|
if s.ds != nil {
|
|
|
|
s.ds.TearDownTest(c)
|
|
|
|
}
|
2015-09-16 13:42:17 -04:00
|
|
|
s.d.Stop()
|
2015-04-24 17:16:56 -04:00
|
|
|
}
|
2015-04-25 22:47:42 -04:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
check.Suite(&DockerDaemonSuite{
|
|
|
|
ds: &DockerSuite{},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
type DockerDaemonSuite struct {
|
|
|
|
ds *DockerSuite
|
|
|
|
d *Daemon
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
|
2015-08-28 13:36:42 -04:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-04-25 22:47:42 -04:00
|
|
|
s.d = NewDaemon(c)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerDaemonSuite) TearDownTest(c *check.C) {
|
2015-08-28 13:36:42 -04:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-04-25 22:47:42 -04:00
|
|
|
s.d.Stop()
|
|
|
|
s.ds.TearDownTest(c)
|
|
|
|
}
|
2015-07-20 01:56:10 -04:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
check.Suite(&DockerTrustSuite{
|
|
|
|
ds: &DockerSuite{},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
type DockerTrustSuite struct {
|
|
|
|
ds *DockerSuite
|
|
|
|
reg *testRegistryV2
|
|
|
|
not *testNotary
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerTrustSuite) SetUpTest(c *check.C) {
|
|
|
|
s.reg = setupRegistry(c)
|
|
|
|
s.not = setupNotary(c)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerTrustSuite) TearDownTest(c *check.C) {
|
|
|
|
s.reg.Close()
|
|
|
|
s.not.Close()
|
|
|
|
s.ds.TearDownTest(c)
|
|
|
|
}
|