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