(t *testing.T, i int, cc metadata.CollectionContext, active []string, brefs map[string][]string)
| 316 | } |
| 317 | |
| 318 | func 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 | |
| 341 | func TestActivateAlreadyExists(t *testing.T) { |
| 342 | td := t.TempDir() |
no test coverage detected
searching dependent graphs…