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

Function TestNetworkOptAdvancedSyntaxInvalid

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

Source from the content-addressed store, hash-verified

135}
136
137func TestNetworkOptAdvancedSyntaxInvalid(t *testing.T) {
138 testCases := []struct {
139 value string
140 expectedError string
141 }{
142 {
143 value: "invalidField=docknet1",
144 expectedError: "invalid field",
145 },
146 {
147 value: "network=docknet1,invalid=web",
148 expectedError: "invalid field",
149 },
150 {
151 value: "driver-opt=field1=value1,driver-opt=field2=value2",
152 expectedError: "network name/id is not specified",
153 },
154 {
155 value: "gw-priority=invalid-integer",
156 expectedError: "invalid gw-priority (invalid-integer): invalid syntax",
157 },
158 }
159 for _, tc := range testCases {
160 t.Run(tc.value, func(t *testing.T) {
161 var network NetworkOpt
162 assert.ErrorContains(t, network.Set(tc.value), tc.expectedError)
163 })
164 }
165}
166
167func TestNetworkOptStringNetOptString(t *testing.T) {
168 networkOpt := &NetworkOpt{}

Callers

nothing calls this directly

Calls 1

SetMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…