[Bug] Test runs before the validator is ready
Describe the bug
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
might run before the validator is ready with all the test setup.
To Reproduce
Run bolt test several times until it happens :) it's an intermittent failure
Expected behavior Consistent tests
Screenshots
InitializeNewWorld:
Error: Simulation failed.
Message: Transaction simulation failed: Error processing Instruction 0: invalid account data for instruction.
Logs:
[
"Program WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n invoke [1]",
"Program is not deployed",
"Program WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n failed: invalid account data for instruction"
].
Catch the `SendTransactionError` and call `getLogs()` on it for full details.
at Connection.sendEncodedTransaction (node_modules/@solana/web3.js/src/connection.ts:6045:13)
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at Connection.sendRawTransaction (node_modules/@solana/web3.js/src/connection.ts:6001:20)
at sendAndConfirmRawTransaction (node_modules/@coral-xyz/anchor/src/provider.ts:377:21)
at AnchorProvider.sendAndConfirm (node_modules/@coral-xyz/anchor/src/provider.ts:163:14)
I am working around this locally by replacing the test command with sleep 5 && yarn .... I might push it if I don't find any better solution
This can be really annoying for newcomers. I might include the workaround in the template asap
An important note is that [test] startup_wait = 5000 is supposed to fix that, but it doesn't have any effect
This is done