Running anchor test
for the bpf-upgrade-state
example program while on localnet results in the following error
Error: AnchorError caused by account: program_data. Error Code: AccountNotInitialized. Error Number: 3012. Error Message: The program expected this account to be already initialized.
Error due to trying to use this address in the test
const programDataAddress = findProgramAddressSync(
[program.programId.toBytes()],
new anchor.web3.PublicKey("BPFLoaderUpgradeab1e11111111111111111111111")
)[0];
anchor test
works fine if on devnet though
The test runs on localnet if I complete the following steps as a workaround:
- run
solana-test-validator
- then
anchor deploy
- then
anchor run test
Found these that seem related:
Could anyone explain why directly running anchor test
for this example does not work on localnet?