2015-04-18 16:46:47 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-06-05 20:09:53 +00:00
|
|
|
"fmt"
|
2015-04-18 16:46:47 +00:00
|
|
|
"testing"
|
|
|
|
|
2015-06-05 20:09:53 +00:00
|
|
|
"github.com/docker/docker/pkg/reexec"
|
2015-04-18 16:46:47 +00:00
|
|
|
"github.com/go-check/check"
|
|
|
|
)
|
|
|
|
|
2015-04-22 18:20:32 +00:00
|
|
|
func Test(t *testing.T) {
|
2015-06-05 20:09:53 +00: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 18:20:32 +00:00
|
|
|
check.TestingT(t)
|
|
|
|
}
|
2015-04-18 16:46:47 +00:00
|
|
|
|
2015-04-24 21:16:56 +00:00
|
|
|
func init() {
|
|
|
|
check.Suite(&DockerSuite{})
|
|
|
|
}
|
|
|
|
|
2015-04-18 16:46:47 +00:00
|
|
|
type DockerSuite struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSuite) TearDownTest(c *check.C) {
|
2015-10-27 20:12:33 +00:00
|
|
|
unpauseAllContainers()
|
2015-04-18 16:46:47 +00:00
|
|
|
deleteAllContainers()
|
2015-04-23 21:39:31 +00:00
|
|
|
deleteAllImages()
|
2015-06-12 13:25:32 +00:00
|
|
|
deleteAllVolumes()
|
2015-10-13 21:18:05 +00:00
|
|
|
deleteAllNetworks()
|
2015-04-18 16:46:47 +00:00
|
|
|
}
|
|
|
|
|
2015-04-24 21:16:56 +00:00
|
|
|
func init() {
|
|
|
|
check.Suite(&DockerRegistrySuite{
|
|
|
|
ds: &DockerSuite{},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
type DockerRegistrySuite struct {
|
|
|
|
ds *DockerSuite
|
|
|
|
reg *testRegistryV2
|
2015-09-16 17:42:17 +00:00
|
|
|
d *Daemon
|
2015-04-24 21:16:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
|
2016-01-29 21:35:20 +00:00
|
|
|
testRequires(c, DaemonIsLinux, RegistryHosting)
|
2016-01-23 18:45:01 +00:00
|
|
|
s.reg = setupRegistry(c, false, false)
|
2015-09-16 17:42:17 +00:00
|
|
|
s.d = NewDaemon(c)
|
2015-04-24 21:16:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerRegistrySuite) TearDownTest(c *check.C) {
|
2015-07-23 09:40:54 +00:00
|
|
|
if s.reg != nil {
|
|
|
|
s.reg.Close()
|
|
|
|
}
|
2016-01-13 09:51:01 +00:00
|
|
|
if s.d != nil {
|
|
|
|
s.d.Stop()
|
2015-07-23 09:40:54 +00:00
|
|
|
}
|
2016-01-13 09:51:01 +00:00
|
|
|
s.ds.TearDownTest(c)
|
2015-04-24 21:16:56 +00:00
|
|
|
}
|
2015-04-26 02:47:42 +00:00
|
|
|
|
2015-12-18 23:06:23 +00:00
|
|
|
func init() {
|
|
|
|
check.Suite(&DockerSchema1RegistrySuite{
|
|
|
|
ds: &DockerSuite{},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
type DockerSchema1RegistrySuite struct {
|
|
|
|
ds *DockerSuite
|
|
|
|
reg *testRegistryV2
|
|
|
|
d *Daemon
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSchema1RegistrySuite) SetUpTest(c *check.C) {
|
2016-01-29 21:35:20 +00:00
|
|
|
testRequires(c, DaemonIsLinux, RegistryHosting)
|
2016-01-23 18:45:01 +00:00
|
|
|
s.reg = setupRegistry(c, true, false)
|
2015-12-18 23:06:23 +00:00
|
|
|
s.d = NewDaemon(c)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSchema1RegistrySuite) TearDownTest(c *check.C) {
|
|
|
|
if s.reg != nil {
|
|
|
|
s.reg.Close()
|
|
|
|
}
|
2016-01-13 09:51:01 +00:00
|
|
|
if s.d != nil {
|
|
|
|
s.d.Stop()
|
2015-12-18 23:06:23 +00:00
|
|
|
}
|
2016-01-13 09:51:01 +00:00
|
|
|
s.ds.TearDownTest(c)
|
2015-12-18 23:06:23 +00:00
|
|
|
}
|
|
|
|
|
2016-01-23 18:45:01 +00:00
|
|
|
func init() {
|
|
|
|
check.Suite(&DockerRegistryAuthSuite{
|
|
|
|
ds: &DockerSuite{},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
type DockerRegistryAuthSuite struct {
|
|
|
|
ds *DockerSuite
|
|
|
|
reg *testRegistryV2
|
|
|
|
d *Daemon
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerRegistryAuthSuite) SetUpTest(c *check.C) {
|
2016-01-29 21:35:20 +00:00
|
|
|
testRequires(c, DaemonIsLinux, RegistryHosting)
|
2016-01-23 18:45:01 +00:00
|
|
|
s.reg = setupRegistry(c, false, true)
|
|
|
|
s.d = NewDaemon(c)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerRegistryAuthSuite) TearDownTest(c *check.C) {
|
|
|
|
if s.reg != nil {
|
|
|
|
out, err := s.d.Cmd("logout", privateRegistryURL)
|
|
|
|
c.Assert(err, check.IsNil, check.Commentf(out))
|
|
|
|
s.reg.Close()
|
|
|
|
}
|
|
|
|
if s.d != nil {
|
|
|
|
s.d.Stop()
|
|
|
|
}
|
|
|
|
s.ds.TearDownTest(c)
|
|
|
|
}
|
|
|
|
|
2015-04-26 02:47:42 +00: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 17:36:42 +00:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-04-26 02:47:42 +00:00
|
|
|
s.d = NewDaemon(c)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerDaemonSuite) TearDownTest(c *check.C) {
|
2015-08-28 17:36:42 +00:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2016-01-13 09:51:01 +00:00
|
|
|
if s.d != nil {
|
|
|
|
s.d.Stop()
|
|
|
|
}
|
2015-04-26 02:47:42 +00:00
|
|
|
s.ds.TearDownTest(c)
|
|
|
|
}
|
2015-07-20 05:56:10 +00:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
check.Suite(&DockerTrustSuite{
|
|
|
|
ds: &DockerSuite{},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
type DockerTrustSuite struct {
|
|
|
|
ds *DockerSuite
|
|
|
|
reg *testRegistryV2
|
|
|
|
not *testNotary
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerTrustSuite) SetUpTest(c *check.C) {
|
2016-01-29 21:35:20 +00:00
|
|
|
testRequires(c, RegistryHosting, NotaryHosting)
|
2016-01-23 18:45:01 +00:00
|
|
|
s.reg = setupRegistry(c, false, false)
|
2015-07-20 05:56:10 +00:00
|
|
|
s.not = setupNotary(c)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerTrustSuite) TearDownTest(c *check.C) {
|
2016-01-13 09:51:01 +00:00
|
|
|
if s.reg != nil {
|
|
|
|
s.reg.Close()
|
|
|
|
}
|
|
|
|
if s.not != nil {
|
|
|
|
s.not.Close()
|
|
|
|
}
|
2015-07-20 05:56:10 +00:00
|
|
|
s.ds.TearDownTest(c)
|
|
|
|
}
|