Rework TestValidator API to be more like ProgramTest

This commit is contained in:
Michael Vines
2020-12-11 20:03:15 -08:00
committed by mergify[bot]
parent 5237da4e01
commit 9f2d154588
6 changed files with 383 additions and 175 deletions

View File

@ -256,14 +256,14 @@ pub fn request_airdrop_transaction(
Ok(transaction)
}
// For integration tests. Listens on random open port and reports port to Sender.
pub fn run_local_faucet(
pub fn run_local_faucet_with_port(
faucet_keypair: Keypair,
sender: Sender<SocketAddr>,
per_time_cap: Option<u64>,
port: u16,
) {
thread::spawn(move || {
let faucet_addr = socketaddr!(0, 0);
let faucet_addr = socketaddr!(0, port);
let faucet = Arc::new(Mutex::new(Faucet::new(
faucet_keypair,
None,
@ -274,6 +274,15 @@ pub fn run_local_faucet(
});
}
// For integration tests. Listens on random open port and reports port to Sender.
pub fn run_local_faucet(
faucet_keypair: Keypair,
sender: Sender<SocketAddr>,
per_time_cap: Option<u64>,
) {
run_local_faucet_with_port(faucet_keypair, sender, per_time_cap, 0)
}
pub fn run_faucet(
faucet: Arc<Mutex<Faucet>>,
faucet_addr: SocketAddr,