MCPcopy Create free account
hub / github.com/Mirantis/cri-dockerd / TestHostNetworkPluginInvocation

Function TestHostNetworkPluginInvocation

core/sandbox_helpers_test.go:297–331  ·  view source on GitHub ↗

TestHostNetworkPluginInvocation checks that *no* SetUp/TearDown calls happen for host network sandboxes.

(t *testing.T)

Source from the content-addressed store, hash-verified

295// TestHostNetworkPluginInvocation checks that *no* SetUp/TearDown calls happen
296// for host network sandboxes.
297func TestHostNetworkPluginInvocation(t *testing.T) {
298 ds, _, _ := newTestDockerService()
299 mockPlugin := newTestNetworkPlugin(t)
300 ds.network = network.NewPluginManager(mockPlugin)
301 defer mockPlugin.Finish()
302
303 name := "foo0"
304 ns := "bar0"
305 c := makeSandboxConfigWithLabelsAndAnnotations(
306 name, ns, "0", 0,
307 map[string]string{"label": name},
308 map[string]string{"annotation": ns},
309 )
310 c.Linux = &runtimeapi.LinuxPodSandboxConfig{
311 SecurityContext: &runtimeapi.LinuxSandboxSecurityContext{
312 NamespaceOptions: &runtimeapi.NamespaceOption{
313 Network: runtimeapi.NamespaceMode_NODE,
314 },
315 },
316 }
317 cID := config.ContainerID{
318 Type: runtimeName,
319 ID: libdocker.GetFakeContainerID(fmt.Sprintf("/%v", makeSandboxName(c))),
320 }
321
322 // No calls to network plugin are expected
323 _, err := ds.RunPodSandbox(getTestCTX(), &runtimeapi.RunPodSandboxRequest{Config: c})
324 require.NoError(t, err)
325
326 _, err = ds.StopPodSandbox(
327 getTestCTX(),
328 &runtimeapi.StopPodSandboxRequest{PodSandboxId: cID.ID},
329 )
330 require.NoError(t, err)
331}
332
333// TestSetUpPodFailure checks that the sandbox should be not ready when it
334// hits a SetUpPod failure.

Callers

nothing calls this directly

Calls 10

NewPluginManagerFunction · 0.92
GetFakeContainerIDFunction · 0.92
newTestDockerServiceFunction · 0.85
newTestNetworkPluginFunction · 0.85
makeSandboxNameFunction · 0.85
getTestCTXFunction · 0.85
FinishMethod · 0.80
RunPodSandboxMethod · 0.80
StopPodSandboxMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…