Questions tagged [program-test]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

solana$ ./cargo test => "error: test failed, to rerun pass `-p solana-cli --test program`" : arguments passed solve nothing

I have a problem when testing the solana chain. I successfully built the solana repo, but after if i do a ./cargo test, i fall on this error: error: test failed, to rerun pass `-p solana-cli --test ...
DavisX's user avatar
  • 3
1 vote
1 answer
27 views

what tx_count means in bench-tps.sh?

I've a questions, for NDEBUG=1 ./multinode-demo/bench-tps.sh --tx_count 50000 what is tx_count ? what happens if I increment or decrement this value? Because by default is 50000 but in the webpage ...
David C's user avatar
  • 13
2 votes
1 answer
272 views

problem with running tests for every program in local env

Problem with local env. tests fail Account doesn't get initiated every time for other program tests as well, but works on solpg anchor test Finished release [optimized] target(s) in 0.10s Found a '...
0xmadhan's user avatar
1 vote
1 answer
48 views

BanksClient: should I prefer `process_transaction_with_metadata` over `process_transaction?`

I've noticed that process_transaction (and process_transaction_with_preflight_and_commitment) hangs when a program is missing from BanksServer or when it encounters an AccountInUse error. It probably ...
KevinH's user avatar
  • 402
0 votes
1 answer
54 views

Learning Programs Security in Solana

I'm looking at learning programs' security in solana. Was wondering if there was something equivalent to Ethernaut or Damn Vulnerable DeFi for Solana programs? Appreciate any help, cheers!
gritty's user avatar
  • 61
2 votes
1 answer
33 views

Does testing through ProgramTestContext have any disadvantage over `solana-test-validator`?

solana-test-validator is basically a full validator run locally. ProgramTestContext looks more light-weight. Does testing through ProgramTestContext skip any checks compared to solana-test-validator?
itsfarseen's user avatar
2 votes
3 answers
166 views

How to fix the "Program processor not available" error in integration test?

Based on the code here I am trying to run an integration test using the solana_program_test crate. The integration test code I am executing is as follows: #![feature(backtrace)] #![cfg(feature = "...
dade's user avatar
  • 282
0 votes
1 answer
181 views

How to measure test coverage for Anchor program?

How do I measure test coverage for an Anchor program? If I write my tests in typescript, then there are no code coverage reports If I write my tests in Rust (similar as specified here), and use the ...
Roberts Ivanovs's user avatar
0 votes
1 answer
43 views

Anchor Testing Workflow? [closed]

How do you guys go about testing? Seems like program unit tests should be standard rust tests with cargo test. There are some program tests that are run with cargo test-bpf. Then test deployment, ...
Robbing Blocks's user avatar
2 votes
1 answer
27 views

Using set_account not able to change cluster sysvar clock

Hey so instead of resorting to warp_to_slot function of the program test crate ,utilizing the set_account function i quickly cooked something along the lines of this Problem am facing is although when ...
Nabeel Naveed's user avatar
0 votes
1 answer
105 views

Mocking the Clock sysvar in solana_program_test

I have a program as follows: Some state is initialized with a start_time Another instruction can be executed on that state, but only if the clock sysvar has passed the given start_time In my tests (...
oscarb.sol's user avatar
0 votes
1 answer
43 views

Getting None for logs in SimulationTransactionDetails

Hey so i am using the following API to execute a tx in a test done using program test crate banks_client.process_transaction_with_preflight_and_commitment_and_context(con, create_user_stake_tx, ...
Nabeel Naveed's user avatar
1 vote
1 answer
46 views

How to get logs of tx done in unit tests using programtest crate

So was doing some e2e testing using ProgramTest Create where we normally use the process_transaction api to execute tx but i was looking for a function which returned a signature or logs so i could ...
Nabeel Naveed's user avatar
1 vote
1 answer
79 views

What is the more up to date way of waiting for a transaction?

When the following code is used during testing, I get the following warning: [tsserver 6387] [I] The signature '(strategy: string, commitment?: Commitment): Promise<RpcResponseAndContext<...
TovarishFin's user avatar
1 vote
0 answers
43 views

Is it possible to make programs use the bpfupgradeable loader in program test crate

Hey as the title states , by default when you add programs to program test context they are added with the bpfloader and not the bpfupgradeable loader, this is an issue as i have some admin only ...
Nabeel Naveed's user avatar