|
@@ -13,10 +13,16 @@ import (
|
|
_ "github.com/docker/docker/pkg/discovery/memory"
|
|
_ "github.com/docker/docker/pkg/discovery/memory"
|
|
"github.com/docker/docker/registry"
|
|
"github.com/docker/docker/registry"
|
|
"github.com/docker/libnetwork"
|
|
"github.com/docker/libnetwork"
|
|
|
|
+ "github.com/sirupsen/logrus"
|
|
"gotest.tools/assert"
|
|
"gotest.tools/assert"
|
|
is "gotest.tools/assert/cmp"
|
|
is "gotest.tools/assert/cmp"
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+// muteLogs suppresses logs that are generated during the test
|
|
|
|
+func muteLogs() {
|
|
|
|
+ logrus.SetLevel(logrus.ErrorLevel)
|
|
|
|
+}
|
|
|
|
+
|
|
func TestDaemonReloadLabels(t *testing.T) {
|
|
func TestDaemonReloadLabels(t *testing.T) {
|
|
daemon := &Daemon{
|
|
daemon := &Daemon{
|
|
configStore: &config.Config{
|
|
configStore: &config.Config{
|
|
@@ -26,6 +32,7 @@ func TestDaemonReloadLabels(t *testing.T) {
|
|
},
|
|
},
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
}
|
|
}
|
|
|
|
+ muteLogs()
|
|
|
|
|
|
valuesSets := make(map[string]interface{})
|
|
valuesSets := make(map[string]interface{})
|
|
valuesSets["labels"] = "foo:baz"
|
|
valuesSets["labels"] = "foo:baz"
|
|
@@ -51,6 +58,7 @@ func TestDaemonReloadAllowNondistributableArtifacts(t *testing.T) {
|
|
configStore: &config.Config{},
|
|
configStore: &config.Config{},
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
}
|
|
}
|
|
|
|
+ muteLogs()
|
|
|
|
|
|
var err error
|
|
var err error
|
|
// Initialize daemon with some registries.
|
|
// Initialize daemon with some registries.
|
|
@@ -106,6 +114,8 @@ func TestDaemonReloadMirrors(t *testing.T) {
|
|
daemon := &Daemon{
|
|
daemon := &Daemon{
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
}
|
|
}
|
|
|
|
+ muteLogs()
|
|
|
|
+
|
|
var err error
|
|
var err error
|
|
daemon.RegistryService, err = registry.NewService(registry.ServiceOptions{
|
|
daemon.RegistryService, err = registry.NewService(registry.ServiceOptions{
|
|
InsecureRegistries: []string{},
|
|
InsecureRegistries: []string{},
|
|
@@ -205,6 +215,8 @@ func TestDaemonReloadInsecureRegistries(t *testing.T) {
|
|
daemon := &Daemon{
|
|
daemon := &Daemon{
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
}
|
|
}
|
|
|
|
+ muteLogs()
|
|
|
|
+
|
|
var err error
|
|
var err error
|
|
// initialize daemon with existing insecure registries: "127.0.0.0/8", "10.10.1.11:5000", "10.10.1.22:5000"
|
|
// initialize daemon with existing insecure registries: "127.0.0.0/8", "10.10.1.11:5000", "10.10.1.22:5000"
|
|
daemon.RegistryService, err = registry.NewService(registry.ServiceOptions{
|
|
daemon.RegistryService, err = registry.NewService(registry.ServiceOptions{
|
|
@@ -297,6 +309,8 @@ func TestDaemonReloadNotAffectOthers(t *testing.T) {
|
|
daemon := &Daemon{
|
|
daemon := &Daemon{
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
}
|
|
}
|
|
|
|
+ muteLogs()
|
|
|
|
+
|
|
daemon.configStore = &config.Config{
|
|
daemon.configStore = &config.Config{
|
|
CommonConfig: config.CommonConfig{
|
|
CommonConfig: config.CommonConfig{
|
|
Labels: []string{"foo:bar"},
|
|
Labels: []string{"foo:bar"},
|
|
@@ -331,6 +345,7 @@ func TestDaemonDiscoveryReload(t *testing.T) {
|
|
daemon := &Daemon{
|
|
daemon := &Daemon{
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
}
|
|
}
|
|
|
|
+ muteLogs()
|
|
daemon.configStore = &config.Config{
|
|
daemon.configStore = &config.Config{
|
|
CommonConfig: config.CommonConfig{
|
|
CommonConfig: config.CommonConfig{
|
|
ClusterStore: "memory://127.0.0.1",
|
|
ClusterStore: "memory://127.0.0.1",
|
|
@@ -411,6 +426,7 @@ func TestDaemonDiscoveryReloadFromEmptyDiscovery(t *testing.T) {
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
|
}
|
|
}
|
|
daemon.configStore = &config.Config{}
|
|
daemon.configStore = &config.Config{}
|
|
|
|
+ muteLogs()
|
|
|
|
|
|
valuesSet := make(map[string]interface{})
|
|
valuesSet := make(map[string]interface{})
|
|
valuesSet["cluster-store"] = "memory://127.0.0.1:2222"
|
|
valuesSet["cluster-store"] = "memory://127.0.0.1:2222"
|