When I run cargo test-bpf --manifest-path=./Cargo.toml on this code
#[tokio::test]
async fn test_init_mapping() {
let program_id = Pubkey::new_unique();
let mut init_map_test = ProgramTest::new(
"simple", // Run the BPF version with `cargo test-bpf`
program_id,
processor!(process_instruction),
);
let main_pubkey = Pubkey::new_unique();
let main_account = Account {
lamports: 100,
owner: program_id,
..Account::default()
};
init_map_test.add_account(main_pubkey, main_account);
let (mut banks_client, payer, recent_blockhash) = init_map_test.start().await;
}
I get this error.
thread 'test_init_mapping' panicked at 'Invoke context not set!'**
I don't know how to debug this, so any help is great. I have narrowed the problem down to the last line. I must have something else set up wrong somewhere in my project?
I dont think this code is a problem as its copy pasted from the helloworld example.
Edit: I left vital details from the original question. After the last line I had msg!("started"); , I assumed irrelevant so left it out of the question