* Deprecate commitment variants * Add new CommitmentConfig builders * Add helpers to avoid allowing deprecated variants * Remove deprecated transaction-status code * Include new commitment variants in runtime commitment; allow deprecated as long as old variants persist * Remove deprecated banks code * Remove deprecated variants in core; allow deprecated in rpc/rpc-subscriptions for now * Heavier hand with rpc/rpc-subscription commitment * Remove deprecated variants from local-cluster * Remove deprecated variants from various tools * Remove deprecated variants from validator * Update docs * Remove deprecated client code * Add new variants to cli; remove deprecated variants as possible * Don't send new commitment variants to old clusters * Retain deprecated method in test_validator_saves_tower * Fix clippy matches! suggestion for BPF solana-sdk legacy compile test * Refactor node version check to handle commitment variants and transaction encoding * Hide deprecated variants from cli help * Add cli App comments
42 lines
1.3 KiB
Rust
42 lines
1.3 KiB
Rust
use solana_cli::cli::{process_command, CliCommand, CliConfig};
|
|
use solana_client::rpc_client::RpcClient;
|
|
use solana_core::test_validator::TestValidator;
|
|
use solana_faucet::faucet::run_local_faucet;
|
|
use solana_sdk::{
|
|
commitment_config::CommitmentConfig,
|
|
signature::{Keypair, Signer},
|
|
};
|
|
use std::sync::mpsc::channel;
|
|
|
|
#[test]
|
|
fn test_cli_request_airdrop() {
|
|
let mint_keypair = Keypair::new();
|
|
let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey());
|
|
|
|
let (sender, receiver) = channel();
|
|
run_local_faucet(mint_keypair, sender, None);
|
|
let faucet_addr = receiver.recv().unwrap();
|
|
|
|
let mut bob_config = CliConfig::recent_for_tests();
|
|
bob_config.json_rpc_url = test_validator.rpc_url();
|
|
bob_config.command = CliCommand::Airdrop {
|
|
faucet_host: None,
|
|
faucet_port: faucet_addr.port(),
|
|
pubkey: None,
|
|
lamports: 50,
|
|
};
|
|
let keypair = Keypair::new();
|
|
bob_config.signers = vec![&keypair];
|
|
|
|
let sig_response = process_command(&bob_config);
|
|
sig_response.unwrap();
|
|
|
|
let rpc_client =
|
|
RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed());
|
|
|
|
let balance = rpc_client
|
|
.get_balance(&bob_config.signers[0].pubkey())
|
|
.unwrap();
|
|
assert_eq!(balance, 50);
|
|
}
|