MCPcopy
hub / github.com/containerd/containerd / TestReload100Pods

Function TestReload100Pods

integration/restart_linux_test.go:84–126  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func TestReload100Pods(t *testing.T) {
85 workDir := t.TempDir()
86
87 currentReleaseCtrdDefaultConfig(t, workDir)
88
89 ctrd := newCtrdProc(t, *containerdBin, workDir, []string{})
90
91 logPath := ctrd.logPath()
92 t.Cleanup(func() {
93 if t.Failed() {
94 dumpFileContent(t, logPath)
95 }
96
97 t.Log("Ensure there is no leaky state dir after test")
98 assert.NoError(t, os.Remove(filepath.Join(workDir, "state", "io.containerd.runtime.v2.task", "k8s.io")))
99 })
100 require.NoError(t, ctrd.isReady())
101
102 podCtxs := []*podTCtx{}
103 defer func() {
104 for _, p := range podCtxs {
105 p.stop(true)
106 }
107 assert.NoError(t, ctrd.kill(syscall.SIGTERM))
108 assert.NoError(t, ctrd.wait(5*time.Minute))
109 }()
110
111 for i := range 100 {
112 podCtx := newPodTCtx(t,
113 ctrd.criRuntimeService(t),
114 fmt.Sprintf("test-restart-%d", i),
115 "sandbox",
116 WithHostNetwork)
117
118 podCtxs = append(podCtxs, podCtx)
119 }
120
121 assert.NoError(t, ctrd.kill(syscall.SIGTERM))
122 assert.NoError(t, ctrd.wait(5*time.Minute))
123
124 ctrd = newCtrdProc(t, *containerdBin, workDir, []string{})
125 require.NoError(t, ctrd.isReady())
126}

Callers

nothing calls this directly

Calls 13

newCtrdProcFunction · 0.85
dumpFileContentFunction · 0.85
newPodTCtxFunction · 0.85
logPathMethod · 0.80
LogMethod · 0.80
isReadyMethod · 0.80
criRuntimeServiceMethod · 0.80
CleanupMethod · 0.65
RemoveMethod · 0.65
stopMethod · 0.45
killMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…