Skip to content

Stop end-to-end runs from losing SpiceDB partway through - #88

Merged
josephschorr merged 2 commits into
mainfrom
fix/e2e-spicedb-lifetime
Dec 4, 2026
Merged

josephschorr merged 2 commits into
mainfrom
fix/e2e-spicedb-lifetime

Conversation

@josephschorr

Copy link
Copy Markdown
Member

End-to-end runs have started failing on unrelated pull requests: the last few scripted scenarios report that SpiceDB refused the connection.

The test setup stops its SpiceDB container 20 minutes after starting it, as a safety net for a test run that was killed. The scripted-scenario package now takes longer than that on a busy CI runner (about 24 minutes, against 19 on an idle one), so the container was being stopped while scenarios were still running.

Changes:

  • The container now stays up for as long as the test run that started it is allowed to run, plus a small margin. The run's own timeout is always the first to fire, so a slow run fails with the name of the test that was running, not with a database error.
  • The end-to-end timeout per package goes from 25 to 40 minutes. The same package was within a minute of the old limit.
  • mage test:bronze runs that package too and was still set to 10 minutes; it now uses the same value.

This does not make the suite faster. The scripted-scenario package keeps growing with every scenario added, and splitting it is the longer-term fix.

Testing

A unit test covers how the container's lifetime is derived from the test timeout. The end-to-end run on this pull request exercises the change itself.

…can run

The fixture stopped its container 1200s after creating it, as a backstop
for a killed test process. The bronzethread package now runs longer than
that on a busy runner, so the container was stopped under it and the
bundles that ran last failed with connection refused.

The lifetime now follows the test binary's own -test.timeout, plus a
margin, so the binary's deadline is always the first to fire. The e2e
package timeout goes from 25m to 40m, since the same package was a
minute short of it, and test:bronze takes the same value instead of 10m.
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
openagentprimitives Ignored Ignored Preview Dec 3, 2026 10:11pm UTC

Request Review

@josephschorr
josephschorr requested a review from samkim December 2, 2026 19:36
…allback

TestTestBinaryTimeout_ReadsTheRunsOwnTimeout asserted only that the value
was positive, so a testBinaryTimeout returning a hardcoded duration still
passed. It now checks that the timeout read, minus the time left until
t.Deadline, equals how long the binary has been running (within 5s), which
a constant misses by however far it is off.

testBinaryTimeout also returned 0 without a word when the test.timeout flag
existed but did not read as a time.Duration, silently moving every container
to the 2h untimed lifetime. Both of those paths now write a line to stderr,
as the rest of the fixture does; an absent flag stays silent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@samkim samkim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR replaces the SpiceDB test container's fixed 20 minute Expire(1200) with a lifetime derived from the running test binary's own -test.timeout (timeout plus 2m, floor 20m, 2h when there is no timeout), and moves the e2e and bronze package timeout to one shared 40m constant.

Verdict: no blockers; approved. A second, independent pass looked only for blockers and found none. What it confirmed:

  • The backstop still works for long lifetimes. Expire issues POST /containers/<id>/stop?t=N from a goroutine with context.Background(), and the docker client sets no request timeout, so nothing on the client side cuts a 42m or 2h stop short.
  • The flag is always read after parsing. startContainer's only callers are Endpoint(t) and SharedEndpoint(t), which run inside m.Run. A read before parsing would see 0 and take the safe 2h fallback.
  • Nothing else depends on the old 20m cap. The reaper decides by owner PID, run ID and label, not by age, and there is no other fixed TTL in the repo.
  • CI time still fits. The e2e job's worst case is about 55m (40m for the package run, 10m for cmd/oap TestApInitLocal, plus build time) against its 90m timeout-minutes.
  • The new tests compile and run under both integration and e2e, matching server.go's build tag.

Two nits from review are fixed in c8a93c0, pushed to this branch:

  1. TestTestBinaryTimeout_ReadsTheRunsOwnTimeout now checks that the timeout it reads matches the run's own -test.timeout: the value minus the time left until t.Deadline() must equal how long the binary has been running, within 5s. A testBinaryTimeout that returned a hardcoded 25m fails it (checked), where the old assert.Positive passed.
  2. testBinaryTimeout now writes a line to stderr before falling back to the 2h lifetime when test.timeout exists but does not read as a time.Duration, per the repo's no-silent-errors rule. An absent flag stays silent.

Verified locally: go vet under integration and e2e, the lifetime tests under both tags and with -timeout=0, and the full test/testspicedb package against Docker.

Questions for the author:

  1. test:steel still runs ./test/e2e/steelthread/... at 10m while the same package gets 40m under test:e2e. Is the 10m fast-fail intended for the steel tier?
  2. The 40m budget leaves about 16m over the 24m busy-runner time for bronzethread. Is there a tracking issue or threshold check for splitting that package before new bundles consume the headroom?

This review was drafted by an automated pipeline and checked before submission.

@josephschorr
josephschorr merged commit 670cb69 into main Dec 4, 2026
10 checks passed
@josephschorr
josephschorr deleted the fix/e2e-spicedb-lifetime branch December 4, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants