MCPcopy
hub / github.com/containerd/containerd / TestContainerdRestart

Function TestContainerdRestart

integration/restart_test.go:36–236  ·  view source on GitHub ↗

Restart test must run sequentially.

(t *testing.T)

Source from the content-addressed store, hash-verified

34// Restart test must run sequentially.
35
36func TestContainerdRestart(t *testing.T) {
37 type container struct {
38 name string
39 id string
40 state runtime.ContainerState
41 }
42 type sandbox struct {
43 name string
44 id string
45 state runtime.PodSandboxState
46 containers []container
47 }
48 ctx := context.Background()
49 sandboxNS := "restart-containerd"
50 sandboxes := []sandbox{
51 {
52 name: "ready-sandbox",
53 state: runtime.PodSandboxState_SANDBOX_READY,
54 containers: []container{
55 {
56 name: "created-container",
57 state: runtime.ContainerState_CONTAINER_CREATED,
58 },
59 {
60 name: "running-container",
61 state: runtime.ContainerState_CONTAINER_RUNNING,
62 },
63 {
64 name: "exited-container",
65 state: runtime.ContainerState_CONTAINER_EXITED,
66 },
67 },
68 },
69 {
70 name: "notready-sandbox",
71 state: runtime.PodSandboxState_SANDBOX_NOTREADY,
72 containers: []container{
73 {
74 name: "created-container",
75 state: runtime.ContainerState_CONTAINER_CREATED,
76 },
77 {
78 name: "exited-container",
79 state: runtime.ContainerState_CONTAINER_EXITED,
80 },
81 },
82 },
83 }
84 // NOTE(claudiub): The test will set the container's Linux.SecurityContext.NamespaceOptions.Pid = NamespaceMode_CONTAINER,
85 // and the expectation is that the container will keep running even if the sandbox container dies.
86 // We do not have that option on Windows.
87 if goruntime.GOOS != "windows" {
88 sandboxes[1].containers = append(sandboxes[1].containers, container{
89 name: "running-container",
90 state: runtime.ContainerState_CONTAINER_RUNNING,
91 })
92 }
93

Callers

nothing calls this directly

Calls 15

GetFunction · 0.92
PodSandboxConfigFunction · 0.85
EnsureImageExistsFunction · 0.85
ContainerConfigFunction · 0.85
WithPidNamespaceFunction · 0.85
RestartContainerdFunction · 0.85
LoadContainerMethod · 0.80
SandboxInfoFunction · 0.70
RunPodSandboxMethod · 0.65
StopPodSandboxMethod · 0.65
RemovePodSandboxMethod · 0.65
CreateContainerMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…