MCPcopy
hub / github.com/containerd/containerd / checkNodeC

Function checkNodeC

core/metadata/gc_test.go:714–734  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T, db *bolt.DB, expected []gc.Node, fn func(context.Context, *bolt.Tx, chan<- gc.Node) error)

Source from the content-addressed store, hash-verified

712}
713
714func checkNodeC(ctx context.Context, t *testing.T, db *bolt.DB, expected []gc.Node, fn func(context.Context, *bolt.Tx, chan<- gc.Node) error) {
715 t.Helper()
716 var actual []gc.Node
717 nc := make(chan gc.Node)
718 done := make(chan struct{})
719 go func() {
720 defer close(done)
721 for n := range nc {
722 actual = append(actual, n)
723 }
724 }()
725 if err := db.View(func(tx *bolt.Tx) error {
726 defer close(nc)
727 return fn(ctx, tx, nc)
728 }); err != nil {
729 t.Fatal(err)
730 }
731
732 <-done
733 checkNodesEqual(t, actual, expected)
734}
735
736func checkNodes(ctx context.Context, t *testing.T, db *bolt.DB, expected []gc.Node, fn func(context.Context, *bolt.Tx, func(context.Context, gc.Node) error) error) {
737 t.Helper()

Callers 3

TestGCRootsFunction · 0.85
TestGCRefsFunction · 0.85
TestCollectibleResourcesFunction · 0.85

Calls 3

checkNodesEqualFunction · 0.85
FatalMethod · 0.80
ViewMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…