MCPcopy Create free account
hub / github.com/bytebase/bytebase / assertFixtureIDsCollide

Function assertFixtureIDsCollide

backend/tests/collision_helper_test.go:294–309  ·  view source on GitHub ↗

assertFixtureIDsCollide verifies that the "colliding IDs" invariant the whole harness depends on is actually true. If a future change adds an extra project-scoped allocation on either path, the tests would silently stop exercising the composite-PK collision case; this assertion fails fast in that ca

(ctx context.Context, t *testing.T, ctl *controller, f *collisionFixture)

Source from the content-addressed store, hash-verified

292// belt-and-suspenders for the task_run claim test, not an
293// independent regression lock.
294func assertFixtureIDsCollide(ctx context.Context, t *testing.T, ctl *controller, f *collisionFixture) {
295 t.Helper()
296 a := require.New(t)
297
298 aPlans := listPlanUIDs(ctx, t, ctl, f.ProjectA.Name)
299 bPlans := listPlanUIDs(ctx, t, ctl, f.ProjectB.Name)
300 a.Greater(len(aPlans), 0, "project A should have at least one plan")
301 a.Greater(len(bPlans), 0, "project B should have at least one plan")
302 assertAtLeastOneUIDCollides(t, aPlans, bPlans, "plan")
303
304 aIssues := listIssueUIDs(ctx, t, ctl, f.ProjectA.Name)
305 bIssues := listIssueUIDs(ctx, t, ctl, f.ProjectB.Name)
306 a.Greater(len(aIssues), 0, "project A should have at least one issue")
307 a.Greater(len(bIssues), 0, "project B should have at least one issue")
308 assertAtLeastOneUIDCollides(t, aIssues, bIssues, "issue")
309}
310
311// completeRolloutB drives project B's rollout to completion and proves that
312// task and task_run ids collide across the two projects. This is the ONLY

Callers 2

setupCollidingProjectsFunction · 0.85

Calls 3

listPlanUIDsFunction · 0.85
listIssueUIDsFunction · 0.85

Tested by

no test coverage detected