mirror of
https://github.com/docker/cli.git
synced 2026-09-27 01:40:31 -04:00
Merge pull request #34495 from ripcurld0/registry_mirror_json
Exit if service config is loaded unsuccessfully on startup Upstream-commit: b075cd2d78c1bafcded7d12ddb2e7c215e2e5117 Component: engine
This commit is contained in:
@@ -47,8 +47,9 @@ func TestDaemonReloadAllowNondistributableArtifacts(t *testing.T) {
|
||||
configStore: &config.Config{},
|
||||
}
|
||||
|
||||
var err error
|
||||
// Initialize daemon with some registries.
|
||||
daemon.RegistryService = registry.NewService(registry.ServiceOptions{
|
||||
daemon.RegistryService, err = registry.NewService(registry.ServiceOptions{
|
||||
AllowNondistributableArtifacts: []string{
|
||||
"127.0.0.0/8",
|
||||
"10.10.1.11:5000",
|
||||
@@ -57,6 +58,9 @@ func TestDaemonReloadAllowNondistributableArtifacts(t *testing.T) {
|
||||
"docker2.com", // This will be removed during reload.
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
registries := []string{
|
||||
"127.0.0.0/8",
|
||||
@@ -95,7 +99,8 @@ func TestDaemonReloadAllowNondistributableArtifacts(t *testing.T) {
|
||||
|
||||
func TestDaemonReloadMirrors(t *testing.T) {
|
||||
daemon := &Daemon{}
|
||||
daemon.RegistryService = registry.NewService(registry.ServiceOptions{
|
||||
var err error
|
||||
daemon.RegistryService, err = registry.NewService(registry.ServiceOptions{
|
||||
InsecureRegistries: []string{},
|
||||
Mirrors: []string{
|
||||
"https://mirror.test1.com",
|
||||
@@ -103,6 +108,9 @@ func TestDaemonReloadMirrors(t *testing.T) {
|
||||
"https://mirror.test3.com", // this will be removed when reloading
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
daemon.configStore = &config.Config{}
|
||||
|
||||
@@ -188,8 +196,9 @@ func TestDaemonReloadMirrors(t *testing.T) {
|
||||
|
||||
func TestDaemonReloadInsecureRegistries(t *testing.T) {
|
||||
daemon := &Daemon{}
|
||||
var err error
|
||||
// initialize daemon with existing insecure registries: "127.0.0.0/8", "10.10.1.11:5000", "10.10.1.22:5000"
|
||||
daemon.RegistryService = registry.NewService(registry.ServiceOptions{
|
||||
daemon.RegistryService, err = registry.NewService(registry.ServiceOptions{
|
||||
InsecureRegistries: []string{
|
||||
"127.0.0.0/8",
|
||||
"10.10.1.11:5000",
|
||||
@@ -198,6 +207,9 @@ func TestDaemonReloadInsecureRegistries(t *testing.T) {
|
||||
"docker2.com", // this will be removed when reloading
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
daemon.configStore = &config.Config{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user