-
Notifications
You must be signed in to change notification settings - Fork 8
fix(#266 Bucket B): reset server+DB between e2e suites — recover V3 Networks visibility (+19 tests) #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(#266 Bucket B): reset server+DB between e2e suites — recover V3 Networks visibility (+19 tests) #273
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,13 +38,43 @@ run_suite() { | |
| echo "" | ||
| } | ||
|
|
||
| # Start server once | ||
| cd /app/server && bun run src/index.ts &>/dev/null & | ||
| sleep 3 | ||
| # Each suite gets a fresh server + fresh DB. Without this, Base E2E leaves | ||
| # 137 tests' worth of state in commhub.db + binds :9200, which then breaks | ||
| # V3 Networks (state pollution → Results line never produced → reported as | ||
| # "0 ran") and Config Priority (its own `bun run src/index.ts &` gets | ||
| # EADDRINUSE because the parent's server still owns :9200, so the suite | ||
| # proceeds against the stale shared server and stops on the first | ||
| # `anet node create` that needs fresh-DB state). See #266 round-1 audit. | ||
| # | ||
| # Suites that don't start their own server (Base E2E, V3 Auth) rely on | ||
| # reset_server() to put one up for them. Suites that DO start their own | ||
| # (V3 Networks, Config Priority) get a free :9200 to bind to. | ||
| reset_server() { | ||
| pkill -f 'bun.*src/index.ts' 2>/dev/null || true | ||
| # Wait for :9200 to actually free up — pkill is async; binding before | ||
| # the old process releases would re-trigger the EADDRINUSE we just fixed. | ||
| for _ in $(seq 1 30); do | ||
| if ! (exec 3<>/dev/tcp/127.0.0.1/9200) 2>/dev/null; then break; fi | ||
| exec 3>&- 2>/dev/null || true | ||
| sleep 0.25 | ||
| done | ||
| rm -rf /root/.commhub /root/.anet 2>/dev/null || true | ||
| cd /app/server && bun run src/index.ts &>/dev/null & | ||
| for _ in $(seq 1 30); do | ||
| curl -sf http://127.0.0.1:9200/health > /dev/null && return 0 | ||
| sleep 0.5 | ||
| done | ||
| echo "::warning::reset_server: server did not respond to /health within 15s" >&2 | ||
| return 1 | ||
| } | ||
|
|
||
| reset_server | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When Useful? React with 👍 / 👎. |
||
| run_suite "Base E2E (137)" "/app/test.sh 2>&1" | ||
| reset_server | ||
| run_suite "V3 Auth (25)" "/app/test-auth.sh 2>&1" | ||
| reset_server | ||
| run_suite "V3 Networks (22)" "/app/test-networks.sh 2>&1" | ||
| reset_server | ||
| run_suite "Config Priority (16)" "/app/test-config.sh 2>&1" | ||
|
Comment on lines
+75
to
78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For the V3 Networks and Config Priority suites, this reset starts a parent server on Useful? React with 👍 / 👎. |
||
|
|
||
| echo "" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the previous server takes longer than this loop to exit, or if another non-matching process owns
:9200, the loop simply falls through and the function proceeds to delete the DB and start a new Bun process anyway. That new process will hitEADDRINUSE, while the later/healthprobe can still succeed against the stale server, so the next suite runs with the old in-memory/open DB state even thoughreset_serverreports success. Track whether the port actually became free and return failure before deleting state or starting the replacement server.Useful? React with 👍 / 👎.