(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)
| 734 | } |
| 735 | |
| 736 | func 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() |
| 738 | var actual []gc.Node |
| 739 | scanFn := func(ctx context.Context, n gc.Node) error { |
| 740 | actual = append(actual, n) |
| 741 | return nil |
| 742 | } |
| 743 | |
| 744 | if err := db.View(func(tx *bolt.Tx) error { |
| 745 | return fn(ctx, tx, scanFn) |
| 746 | }); err != nil { |
| 747 | t.Fatal(err) |
| 748 | } |
| 749 | |
| 750 | checkNodesEqual(t, actual, expected) |
| 751 | } |
| 752 | |
| 753 | func checkNodesEqual(t *testing.T, n1, n2 []gc.Node) { |
| 754 | t.Helper() |
no test coverage detected
searching dependent graphs…