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

Function TestNetworks

cli/compose/convert/compose_test.go:43–121  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestNetworks(t *testing.T) {
44 namespace := Namespace{name: "foo"}
45 serviceNetworks := map[string]struct{}{
46 "normal": {},
47 "outside": {},
48 "default": {},
49 "attachablenet": {},
50 "named": {},
51 }
52 source := networkMap{
53 "normal": composetypes.NetworkConfig{
54 Driver: "overlay",
55 DriverOpts: map[string]string{
56 "opt": "value",
57 },
58 Ipam: composetypes.IPAMConfig{
59 Driver: "driver",
60 Config: []*composetypes.IPAMPool{
61 {
62 Subnet: "10.0.0.0/32",
63 },
64 },
65 },
66 Labels: map[string]string{
67 "something": "labeled",
68 },
69 },
70 "outside": composetypes.NetworkConfig{
71 External: composetypes.External{External: true},
72 Name: "special",
73 },
74 "attachablenet": composetypes.NetworkConfig{
75 Driver: "overlay",
76 Attachable: true,
77 },
78 "named": composetypes.NetworkConfig{
79 Name: "othername",
80 },
81 }
82 expected := map[string]client.NetworkCreateOptions{
83 "foo_default": {
84 Labels: map[string]string{
85 LabelNamespace: "foo",
86 },
87 },
88 "foo_normal": {
89 Driver: "overlay",
90 IPAM: &network.IPAM{
91 Driver: "driver",
92 Config: []network.IPAMConfig{
93 {
94 Subnet: netip.MustParsePrefix("10.0.0.0/32"),
95 },
96 },
97 },
98 Options: map[string]string{
99 "opt": "value",
100 },

Callers

nothing calls this directly

Calls 1

NetworksFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…