MCPcopy Create free account
hub / github.com/docker/cli / TestLoadInsecureRegistries

Function TestLoadInsecureRegistries

internal/registry/config_test.go:10–92  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestLoadInsecureRegistries(t *testing.T) {
11 testCases := []struct {
12 registries []string
13 index string
14 err string
15 }{
16 {
17 registries: []string{"127.0.0.1"},
18 index: "127.0.0.1",
19 },
20 {
21 registries: []string{"127.0.0.1:8080"},
22 index: "127.0.0.1:8080",
23 },
24 {
25 registries: []string{"2001:db8::1"},
26 index: "2001:db8::1",
27 },
28 {
29 registries: []string{"[2001:db8::1]:80"},
30 index: "[2001:db8::1]:80",
31 },
32 {
33 registries: []string{"http://myregistry.example.com"},
34 index: "myregistry.example.com",
35 },
36 {
37 registries: []string{"https://myregistry.example.com"},
38 index: "myregistry.example.com",
39 },
40 {
41 registries: []string{"HTTP://myregistry.example.com"},
42 index: "myregistry.example.com",
43 },
44 {
45 registries: []string{"svn://myregistry.example.com"},
46 err: "insecure registry svn://myregistry.example.com should not contain '://'",
47 },
48 {
49 registries: []string{`mytest-.com`},
50 err: `insecure registry mytest-.com is not valid: invalid host "mytest-.com"`,
51 },
52 {
53 registries: []string{`1200:0000:AB00:1234:0000:2552:7777:1313:8080`},
54 err: `insecure registry 1200:0000:AB00:1234:0000:2552:7777:1313:8080 is not valid: invalid host "1200:0000:AB00:1234:0000:2552:7777:1313:8080"`,
55 },
56 {
57 registries: []string{`myregistry.example.com:500000`},
58 err: `insecure registry myregistry.example.com:500000 is not valid: invalid port "500000"`,
59 },
60 {
61 registries: []string{`"myregistry.example.com"`},
62 err: `insecure registry "myregistry.example.com" is not valid: invalid host "\"myregistry.example.com\""`,
63 },
64 {
65 registries: []string{`"myregistry.example.com:5000"`},
66 err: `insecure registry "myregistry.example.com:5000" is not valid: invalid host "\"myregistry.example.com"`,
67 },

Callers

nothing calls this directly

Calls 1

newServiceConfigFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…