MCPcopy
hub / github.com/containerd/containerd / checkGCActive

Function checkGCActive

core/mount/manager/manager_test.go:318–339  ·  view source on GitHub ↗
(t *testing.T, i int, cc metadata.CollectionContext, active []string, brefs map[string][]string)

Source from the content-addressed store, hash-verified

316}
317
318func checkGCActive(t *testing.T, i int, cc metadata.CollectionContext, active []string, brefs map[string][]string) {
319 t.Helper()
320 ccb := cc.(interface {
321 ActiveWithBackRefs(string, func(gc.Node), func(gc.Node, gc.Node))
322 })
323
324 var (
325 activeKeys []string
326 activeBrefs = map[string][]string{}
327 )
328 ccb.ActiveWithBackRefs("test", func(n gc.Node) {
329 activeKeys = append(activeKeys, n.Key)
330 }, func(n, ref gc.Node) {
331 activeBrefs[n.Key] = append(activeBrefs[n.Key], ref.Key)
332 })
333
334 require.Equal(t, active, activeKeys, "run %d: active does not match", i)
335
336 for k := range brefs {
337 require.Equal(t, brefs[k], activeBrefs[k], "run %d: brefs for %q does not match", i, k)
338 }
339}
340
341func TestActivateAlreadyExists(t *testing.T) {
342 td := t.TempDir()

Callers 1

TestGCFunction · 0.85

Calls 1

ActiveWithBackRefsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…