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

Function assertTaskRunsCollide

backend/tests/collision_helper_test.go:355–364  ·  view source on GitHub ↗

assertTaskRunsCollide verifies that after both projects have rolled out, their task_run ids collide. Call this from tests that run project B's rollout and depend on task_run collisions. Note: nextProjectID allocates per table, so task_run collision does not imply plan_check_run collision. Each tabl

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

Source from the content-addressed store, hash-verified

353// Note: nextProjectID allocates per table, so task_run collision does not
354// imply plan_check_run collision. Each table needs its own assertion.
355func assertTaskRunsCollide(ctx context.Context, t *testing.T, ctl *controller, f *collisionFixture) {
356 t.Helper()
357 a := require.New(t)
358
359 aTaskRuns, _ := listTaskRunAndTaskUIDs(ctx, t, ctl, f.PlanA.Name)
360 bTaskRuns, _ := listTaskRunAndTaskUIDs(ctx, t, ctl, f.PlanB.Name)
361 a.Greater(len(aTaskRuns), 0, "project A should have at least one task_run")
362 a.Greater(len(bTaskRuns), 0, "project B should have at least one task_run — did you forget to roll out B?")
363 assertAtLeastOneUIDCollides(t, aTaskRuns, bTaskRuns, "task_run")
364}
365
366// assertTasksCollide verifies that task UIDs collide across projects.
367// Task UIDs are embedded in task_run resource names, so we can derive

Callers 1

completeRolloutBMethod · 0.85

Calls 2

listTaskRunAndTaskUIDsFunction · 0.85

Tested by

no test coverage detected