3

trying to learn anchor dev, following soldev.app. I have a problem, when I run anchor test, this is the error I get:

Unable to get the latest blockhash. The test validator does not look started. Check .anchor/test-ledger/test-ledger-log.txt for errors. Consider increasing [test.startup_wait] in Anchor.toml.

Ledger location: .anchor/test-ledger Log: .anchor/test-ledger/validator.log Initializing... Error: failed to start validator: Failed to create ledger at .anchor/test-ledger: blockstore error

When I try to run solana-test-validator it works. In the anchor.toml file cluster is set to localnet.

1 Answer 1

4

Run solana-test-validator in a separate terminal.

Then run anchor test --skip-local-validator whenever you wanna test your program.

You can create an alias if this gets tedious. e.g. alias anchortest="anchor test --skip-local-validator

2
  • 1
    The flag --skip-local-validator is so badly named because you pass it to anchor test to skip local validator, and yet anchor test requires solana-test-validator to run (in a separate terminal). Sounds like a prank! HAHA.
    – Nawaz
    Feb 11 at 15:48
  • I'm joining to @Nawaz There must be a self validator in test environment. Sep 8 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.