Initial solana-test-validator command-line program

This commit is contained in:
Michael Vines
2020-12-08 23:18:27 -08:00
committed by mergify[bot]
parent 13db3eca9f
commit 0a9ff1dc9d
25 changed files with 786 additions and 348 deletions

View File

@ -1038,7 +1038,7 @@ mod tests {
use solana_core::test_validator::TestValidator;
use solana_sdk::{
clock::DEFAULT_MS_PER_SLOT,
signature::{read_keypair_file, write_keypair_file},
signature::{read_keypair_file, write_keypair_file, Signer},
};
use solana_stake_program::stake_instruction::StakeInstruction;
@ -1057,8 +1057,8 @@ mod tests {
#[test]
fn test_process_token_allocations() {
let test_validator = TestValidator::with_no_fees();
let alice = test_validator.mint_keypair();
let alice = Keypair::new();
let test_validator = TestValidator::with_no_fees(alice.pubkey());
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::recent());
@ -1069,8 +1069,8 @@ mod tests {
#[test]
fn test_process_transfer_amount_allocations() {
let test_validator = TestValidator::with_no_fees();
let alice = test_validator.mint_keypair();
let alice = Keypair::new();
let test_validator = TestValidator::with_no_fees(alice.pubkey());
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::recent());
@ -1081,8 +1081,8 @@ mod tests {
#[test]
fn test_process_stake_allocations() {
let test_validator = TestValidator::with_no_fees();
let alice = test_validator.mint_keypair();
let alice = Keypair::new();
let test_validator = TestValidator::with_no_fees(alice.pubkey());
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::recent());
@ -1398,8 +1398,8 @@ mod tests {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let test_validator = TestValidator::with_custom_fees(fees);
let alice = test_validator.mint_keypair();
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::recent());
@ -1485,8 +1485,8 @@ mod tests {
fn test_check_payer_balances_distribute_tokens_separate_payers() {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let test_validator = TestValidator::with_custom_fees(fees);
let alice = test_validator.mint_keypair();
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::recent());
@ -1598,8 +1598,8 @@ mod tests {
fn test_check_payer_balances_distribute_stakes_single_payer() {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let test_validator = TestValidator::with_custom_fees(fees);
let alice = test_validator.mint_keypair();
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::recent());
test_validator_block_0_fee_workaround(&client);
@ -1707,8 +1707,8 @@ mod tests {
fn test_check_payer_balances_distribute_stakes_separate_payers() {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let test_validator = TestValidator::with_custom_fees(fees);
let alice = test_validator.mint_keypair();
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(alice.pubkey(), fees);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::recent());
@ -2025,8 +2025,8 @@ mod tests {
#[test]
fn test_distribute_allocations_dump_db() {
let test_validator = TestValidator::with_no_fees();
let sender_keypair = test_validator.mint_keypair();
let sender_keypair = Keypair::new();
let test_validator = TestValidator::with_no_fees(sender_keypair.pubkey());
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::recent());

View File

@ -1,15 +1,17 @@
use solana_client::rpc_client::RpcClient;
use solana_core::test_validator::TestValidator;
use solana_sdk::signature::{Keypair, Signer};
use solana_tokens::commands::test_process_distribute_tokens_with_client;
#[test]
fn test_process_distribute_with_rpc_client() {
solana_logger::setup();
let test_validator = TestValidator::with_no_fees();
let mint_keypair = Keypair::new();
let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey());
let client = RpcClient::new(test_validator.rpc_url());
test_process_distribute_tokens_with_client(&client, test_validator.mint_keypair(), None);
test_process_distribute_tokens_with_client(&client, mint_keypair, None);
test_validator.close();
}