WIP: per-case contexts in the partway test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+10
−9
internal/docs/home_links_move_test.go+10 −9
Intent
diff --git a/internal/docs/home_links_move_test.go b/internal/docs/home_links_move_test.go| index e0f0270..f580716 100644 |
| --- a/internal/docs/home_links_move_test.go |
| +++ b/internal/docs/home_links_move_test.go |
| @@ -428,15 +428,16 @@ func TestLinksMoveThatStopsPartwayLeavesTheOldState(t *testing.T) { |
| w := d.Writer() |
| before, rows, clock := schemaDump(t, w), oldLinks(t, w), linkClock(t, w, "docs_link_clock") |
| newClock := linkClock(t, w, "home_link_clock") |
| - ctx, cancel := context.WithCancel(t.Context()) |
| - defer cancel() |
| - for name, stop := range map[string]func(context.Context, *sql.Tx, string, string, int64) error{ |
| - "storage": func(context.Context, *sql.Tx, string, string, int64) error { return connectlinks.ErrStorage }, |
| - "cancelled": func(context.Context, *sql.Tx, string, string, int64) error { |
| - cancel() |
| - return context.Canceled |
| - }, |
| - } { |
| + for _, name := range []string{"storage", "cancelled"} { |
| + ctx, cancel := context.WithCancel(t.Context()) |
| + defer cancel() |
| + stop := func(context.Context, *sql.Tx, string, string, int64) error { return connectlinks.ErrStorage } |
| + if name == "cancelled" { |
| + stop = func(context.Context, *sql.Tx, string, string, int64) error { |
| + cancel() |
| + return context.Canceled |
| + } |
| + } |
| adopted := 0 |
| err := moveLinksOntoConnect(ctx, w, adoptFunc(func(ctx context.Context, tx *sql.Tx, issuer, subject string, person int64) error { |
| if adopted++; adopted == 2 { |