TestHostNetworkPluginInvocation checks that *no* SetUp/TearDown calls happen for host network sandboxes.
(t *testing.T)
| 295 | // TestHostNetworkPluginInvocation checks that *no* SetUp/TearDown calls happen |
| 296 | // for host network sandboxes. |
| 297 | func 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. |
nothing calls this directly
no test coverage detected
searching dependent graphs…