MCPcopy
hub / github.com/moby/moby / TestCreateWithPriority

Function TestCreateWithPriority

integration/network/network_linux_test.go:232–265  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

230}
231
232func TestCreateWithPriority(t *testing.T) {
233 // This feature should work on Windows, but the test is skipped because:
234 // 1. Linux-specific tools are used here; 2. 'windows' IPAM driver doesn't
235 // support static allocations.
236 skip.If(t, testEnv.DaemonInfo.OSType == "windows")
237 skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.48"), "requires API v1.48")
238
239 ctx := setupTest(t)
240 apiClient := testEnv.APIClient()
241
242 network.CreateNoError(ctx, t, apiClient, "testnet1",
243 network.WithIPv6(),
244 network.WithIPAM("10.100.20.0/24", "10.100.20.1"),
245 network.WithIPAM("fd54:7a1b:8269::/64", "fd54:7a1b:8269::1"))
246 defer network.RemoveNoError(ctx, t, apiClient, "testnet1")
247
248 network.CreateNoError(ctx, t, apiClient, "testnet2",
249 network.WithIPv6(),
250 network.WithIPAM("10.100.30.0/24", "10.100.30.1"),
251 network.WithIPAM("fdff:6dfe:37d2::/64", "fdff:6dfe:37d2::1"))
252 defer network.RemoveNoError(ctx, t, apiClient, "testnet2")
253
254 ctrID := container.Run(ctx, t, apiClient,
255 container.WithCmd("sleep", "infinity"),
256 container.WithNetworkMode("testnet1"),
257 container.WithEndpointSettings("testnet1", &networktypes.EndpointSettings{GwPriority: 10}),
258 container.WithEndpointSettings("testnet2", &networktypes.EndpointSettings{GwPriority: 100}))
259 defer container.Remove(ctx, t, apiClient, ctrID, client.ContainerRemoveOptions{Force: true})
260
261 checkCtrRoutes(t, ctx, apiClient, ctrID, syscall.AF_INET, 3, "default via 10.100.30.1 dev")
262 // IPv6 routing table will contain for each interface, one route for the LL
263 // address, one for the ULA, and one multicast.
264 checkCtrRoutes(t, ctx, apiClient, ctrID, syscall.AF_INET6, 7, "default via fdff:6dfe:37d2::1 dev")
265}
266
267func TestConnectWithPriority(t *testing.T) {
268 // This feature should work on Windows, but the test is skipped because:

Callers

nothing calls this directly

Calls 13

CreateNoErrorFunction · 0.92
WithIPv6Function · 0.92
WithIPAMFunction · 0.92
RemoveNoErrorFunction · 0.92
RunFunction · 0.92
WithCmdFunction · 0.92
WithNetworkModeFunction · 0.92
WithEndpointSettingsFunction · 0.92
RemoveFunction · 0.92
checkCtrRoutesFunction · 0.85
DaemonAPIVersionMethod · 0.80
APIClientMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…