anchor
anchor copied to clipboard
cli: Renaming program mod causes test to fail
Steps to reproduce
- anchor init hello
- anchor test
- change the progrma's main
mod hello
tomod fails_now_hello
- anchor test
The test will throw Transaction simulation failed: Attempt to load a program that does not exist
.
This is caused by the fact that there are two target/idl
idls and only a single program.
Related, or potentially a dup of https://github.com/project-serum/anchor/issues/109.
This is reproducible now without changing the program name. Pretty big noob here, and I've got no idea why sorry. But pretty hard to get up and running when the init
doesn't work :smile:
Steps to reproduce
- anchor init hello
- anchor build
- anchor deploy
- anchor test
The test will throw Transaction simulation failed: Attempt to load a program that does not exist.
When I log anchor
import it shows workspace: {},
@ezy I was able to get around this. I'm not sure what the underlying issue is, but I noticed that the solana-test-validator process was still running between tests (maybe there was an initially failed test that left it hanging...idk).
- Checked if local chain was running
ps au
- killed local solana-test-validator process
- Cleaned out the workspace
cargo clean
- Deleted node_modules
rm -rf node_modules
- Reinstalled node modules
yarn install
- Re-ran tests
anchor test
My hunch is the issue has something to do with the hanging solana-test-validator process.
I had similar problems here @ezy - did you try anchor test --skip-local-validator
?
Thanks @tomjohn1028, followed the instructions more closely and got it working.
Ran into the same issue, then realized I missed the line that said Make sure to turn off the validator before you begin testing Anchor programs.
so I was able to get it running by simply stopping the validator 😅
As @h4rkl mentioned, you can also run anchor test --skip-local-validator
Anyone know why I might be hanging on the finalize transaction part of the "anchor tests"? M1 mac also
Hi @bbroeking I am having the same issue on an m1 mac too
@tomjohn1028 For me, the issue ended up being that my solana-test-validator
was already running. Killing that process did the trick. Surprisingly the extremely thorough Solana dapp tutorial here didn't mention making sure local Solana processes were stopped whilst testing. 🤔
Still not working... M1 Mac here.
Running solana-test-validator --no-bpf-jit
and then anchor test --skip-local-validator
still fails.
It's sorted now actually. I had to update my Program ID after the initial deploy.
It's sorted now actually. I had to update my Program ID after the initial deploy.
How did you update the program ID?
@ezy I was able to get around this. I'm not sure what the underlying issue is, but I noticed that the solana-test-validator process was still running between tests (maybe there was an initially failed test that left it hanging...idk).
1. Checked if local chain was running `ps au` 2. killed local _solana-test-validator_ process 3. Cleaned out the workspace `cargo clean` 4. Deleted node_modules `rm -rf node_modules` 5. Reinstalled node modules `yarn install` 6. Re-ran tests `anchor test`
My hunch is the issue has something to do with the hanging solana-test-validator process.
When I turn off the solana-test-validator and run anchor test, I get this error: Unable to get recent blockhash. Test validator does not look started. Check .anchor/test-ledger/test-ledger-log.txt for errors. Consider increasing [test.startup_wait] in Anchor.toml.
@umair-mirza I have the same issue
@ezy I was able to get around this. I'm not sure what the underlying issue is, but I noticed that the solana-test-validator process was still running between tests (maybe there was an initially failed test that left it hanging...idk).
1. Checked if local chain was running `ps au` 2. killed local _solana-test-validator_ process 3. Cleaned out the workspace `cargo clean` 4. Deleted node_modules `rm -rf node_modules` 5. Reinstalled node modules `yarn install` 6. Re-ran tests `anchor test`
My hunch is the issue has something to do with the hanging solana-test-validator process.
When I turn off the solana-test-validator and run anchor test, I get this error: Unable to get recent blockhash. Test validator does not look started. Check .anchor/test-ledger/test-ledger-log.txt for errors. Consider increasing [test.startup_wait] in Anchor.toml.
I'm facing the same issue. Did you find the solution to this? Please help
@umair-mirza I have the same issue
Hey did you find the solution to this problem. i'm facing the same issue rn. Please help
I had the same issue
Please check the network rpc... I had a same issue on my side but I reset the network rpc to the right! Then it works