MCPcopy
hub / github.com/containerd/containerd / TestGC

Function TestGC

core/mount/manager/manager_test.go:152–316  ·  view source on GitHub ↗

TestGC tests the garbage collecion features of the mount manager, ensuring that mounts are properly cleaned up when no longer needed.

(t *testing.T)

Source from the content-addressed store, hash-verified

150// TestGC tests the garbage collecion features of the mount manager,
151// ensuring that mounts are properly cleaned up when no longer needed.
152func TestGC(t *testing.T) {
153 type gcrun struct {
154 a []mount.Mount
155 o []mount.ActivateOpt
156 d []string
157 all []string
158 active []string
159 brefs map[string][]string
160 remove []string
161 gcErr bool
162 }
163
164 for _, tc := range []struct {
165 name string
166 gcruns []gcrun
167 }{
168 {
169 name: "Simple",
170 gcruns: []gcrun{
171 {
172 a: []mount.Mount{
173 {
174 Type: "noop",
175 },
176 },
177 all: []string{"0-0"},
178 remove: []string{},
179 },
180 {
181 all: []string{"0-0"},
182 remove: []string{"0-0"},
183 },
184 {},
185 },
186 },
187 {
188 name: "UnmountError",
189 gcruns: []gcrun{
190 {
191 a: []mount.Mount{
192 {
193 Type: "error",
194 },
195 },
196 all: []string{"0-0"},
197 remove: []string{},
198 },
199 {
200 all: []string{"0-0"},
201 remove: []string{"0-0"},
202 gcErr: true, // Expect an error on garbage collection due to unmount error
203 },
204 {}, // Run again without error to bring mount count back to zero
205 },
206 },
207 {
208 name: "ActiveBrefs",
209 gcruns: []gcrun{

Callers

nothing calls this directly

Calls 15

ActivateMethod · 0.95
DeactivateMethod · 0.95
WithLabelsFunction · 0.92
WithNamespaceFunction · 0.92
newFunction · 0.85
WithMountHandlerFunction · 0.85
checkGCActiveFunction · 0.85
FatalMethod · 0.80
LoadMethod · 0.80
NewManagerFunction · 0.70
RunMethod · 0.65
CleanupMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…