Solana: Test suite not idempotent — 3 failures when tests share validator state #63

Closed
opened 2026-03-19 08:41:54 +00:00 by Brouie · 2 comments
Brouie commented 2026-03-19 08:41:54 +00:00 (Migrated from gitlab.com)

Branch: feat/solana-integration\nResults: 12/15 pass, 3 fail\n\nRoot cause: Multiple test files share the same validator state. cancel_flow or deposit_withdraw 'before' hooks initialize the bridge PDA before bridge.test.ts runs, so:\n\n1. 'initializes bridge config' — fails with 0x0 (PDA already exists)\n2. 'rejects invalid fee bps' — fails because error is 'account in use' not 'InvalidFeeBps'\n3. 'registers a chain' — fails because chain PDA already registered\n\nThese cascade to fail cancel_flow and deposit_withdraw 'before all' hooks (5 total failures shown).\n\nEach file passes individually. The issue only appears running all files together.\n\nSuggested fix: Either add idempotent init (check if PDA exists before init) or ensure test execution order with mocha --sort, or move initialize to a shared before hook.

**Branch:** feat/solana-integration\n**Results:** 12/15 pass, 3 fail\n\n**Root cause:** Multiple test files share the same validator state. cancel_flow or deposit_withdraw 'before' hooks initialize the bridge PDA before bridge.test.ts runs, so:\n\n1. 'initializes bridge config' — fails with 0x0 (PDA already exists)\n2. 'rejects invalid fee bps' — fails because error is 'account in use' not 'InvalidFeeBps'\n3. 'registers a chain' — fails because chain PDA already registered\n\nThese cascade to fail cancel_flow and deposit_withdraw 'before all' hooks (5 total failures shown).\n\n**Each file passes individually.** The issue only appears running all files together.\n\n**Suggested fix:** Either add idempotent init (check if PDA exists before init) or ensure test execution order with mocha --sort, or move initialize to a shared before hook.
PlasticDigits commented 2026-03-19 12:04:15 +00:00 (Migrated from gitlab.com)

mentioned in commit bc4cecc324

mentioned in commit bc4cecc324830ea8aad3829d53c6f3f6093947ea
PlasticDigits commented 2026-03-23 03:36:33 +00:00 (Migrated from gitlab.com)

@Brouie Please review and confirm fix

@Brouie Please review and confirm fix
Brouie (Migrated from gitlab.com) closed this issue 2026-03-23 03:59:17 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-bridge-monorepo#63
No description provided.