MCPcopy Index your code
hub / github.com/docker/cli / TestNetworkOptAdvancedSyntax

Function TestNetworkOptAdvancedSyntax

opts/network_test.go:33–135  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestNetworkOptAdvancedSyntax(t *testing.T) {
34 testCases := []struct {
35 value string
36 expected []NetworkAttachmentOpts
37 }{
38 {
39 value: "name=docknet1,alias=web,driver-opt=field1=value1",
40 expected: []NetworkAttachmentOpts{
41 {
42 Target: "docknet1",
43 Aliases: []string{"web"},
44 DriverOpts: map[string]string{
45 "field1": "value1",
46 },
47 },
48 },
49 },
50 {
51 value: "name=docknet1,alias=web1,alias=web2,driver-opt=field1=value1,driver-opt=field2=value2",
52 expected: []NetworkAttachmentOpts{
53 {
54 Target: "docknet1",
55 Aliases: []string{"web1", "web2"},
56 DriverOpts: map[string]string{
57 "field1": "value1",
58 "field2": "value2",
59 },
60 },
61 },
62 },
63 {
64 value: "name=docknet1,ip=172.20.88.22,ip6=2001:db8::8822",
65 expected: []NetworkAttachmentOpts{
66 {
67 Target: "docknet1",
68 Aliases: []string{},
69 IPv4Address: netip.MustParseAddr("172.20.88.22"),
70 IPv6Address: netip.MustParseAddr("2001:db8::8822"),
71 },
72 },
73 },
74 {
75 value: "name=docknet1",
76 expected: []NetworkAttachmentOpts{
77 {
78 Target: "docknet1",
79 Aliases: []string{},
80 },
81 },
82 },
83 {
84 value: "name=docknet1,mac-address=52:0f:f3:dc:50:10",
85 expected: []NetworkAttachmentOpts{
86 {
87 Target: "docknet1",
88 Aliases: []string{},
89 MacAddress: "52:0f:f3:dc:50:10",
90 },

Callers

nothing calls this directly

Calls 2

SetMethod · 0.95
ValueMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…