Release builds for local cluster tests (#5891)
* Release builds for test * Remove setting thread count in local cluster * Increase timeout * Move local cluster to separate job * Extract out local cluster test from bench-tps * Make local cluster inaccessible from outside crate * Update test-stable.sh to exclude local_cluster in stable, include it in local-cluster CI job * Move bench-exchange to local cluster * Remove local cluster from coverage
This commit is contained in:
@ -11,9 +11,16 @@ homepage = "https://solana.com/"
|
||||
[dependencies]
|
||||
log = "0.4.8"
|
||||
rand = "0.6.5"
|
||||
solana-bench-exchange = { path = "../bench-exchange", version = "0.19.0-pre0" }
|
||||
solana-bench-tps = { path = "../bench-tps", version = "0.19.0-pre0" }
|
||||
solana-core = { path = "../core", version = "0.19.0-pre0" }
|
||||
solana-client = { path = "../client", version = "0.19.0-pre0" }
|
||||
solana-drone = { path = "../drone", version = "0.19.0-pre0" }
|
||||
solana-exchange-api = { path = "../programs/exchange_api", version = "0.19.0-pre0" }
|
||||
solana-exchange-program = { path = "../programs/exchange_program", version = "0.19.0-pre0" }
|
||||
solana-logger = { path = "../logger", version = "0.19.0-pre0" }
|
||||
solana-move-loader-api = { path = "../programs/move_loader_api", version = "0.19.0-pre0" }
|
||||
solana-move-loader-program = { path = "../programs/move_loader_program", version = "0.19.0-pre0" }
|
||||
solana-runtime = { path = "../runtime", version = "0.19.0-pre0" }
|
||||
solana-sdk = { path = "../sdk", version = "0.19.0-pre0" }
|
||||
solana-stake-api = { path = "../programs/stake_api", version = "0.19.0-pre0" }
|
||||
|
@ -1,14 +1,40 @@
|
||||
pub mod cluster;
|
||||
pub mod cluster_tests;
|
||||
pub mod local_cluster;
|
||||
#[cfg(test)]
|
||||
mod cluster;
|
||||
#[cfg(test)]
|
||||
mod cluster_tests;
|
||||
#[cfg(test)]
|
||||
mod local_cluster;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
#[macro_use]
|
||||
#[cfg(test)]
|
||||
extern crate log;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate solana_bench_exchange;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate solana_bench_tps;
|
||||
|
||||
#[macro_use]
|
||||
#[cfg(test)]
|
||||
extern crate solana_core;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate solana_drone;
|
||||
|
||||
#[macro_use]
|
||||
#[cfg(test)]
|
||||
extern crate solana_exchange_program;
|
||||
|
||||
#[macro_use]
|
||||
#[cfg(test)]
|
||||
extern crate solana_move_loader_program;
|
||||
|
||||
#[macro_use]
|
||||
#[cfg(test)]
|
||||
extern crate solana_storage_program;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate tempfile;
|
||||
|
@ -10,7 +10,6 @@ use solana_core::{
|
||||
service::Service,
|
||||
validator::{Validator, ValidatorConfig},
|
||||
};
|
||||
use solana_rayon_threadlimit::set_thread_count;
|
||||
use solana_sdk::{
|
||||
client::SyncClient,
|
||||
clock::DEFAULT_TICKS_PER_SLOT,
|
||||
@ -117,8 +116,6 @@ impl LocalCluster {
|
||||
}
|
||||
|
||||
pub fn new(config: &ClusterConfig) -> Self {
|
||||
set_thread_count(1);
|
||||
|
||||
assert_eq!(config.validator_configs.len(), config.node_stakes.len());
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let leader_pubkey = leader_keypair.pubkey();
|
||||
|
4
local_cluster/src/tests.rs
Normal file
4
local_cluster/src/tests.rs
Normal file
@ -0,0 +1,4 @@
|
||||
mod bench_exchange;
|
||||
mod bench_tps;
|
||||
mod local_cluster;
|
||||
mod replicator;
|
100
local_cluster/src/tests/bench_exchange.rs
Normal file
100
local_cluster/src/tests/bench_exchange.rs
Normal file
@ -0,0 +1,100 @@
|
||||
use crate::local_cluster::{ClusterConfig, LocalCluster};
|
||||
use solana_bench_exchange::bench::{airdrop_lamports, do_bench_exchange, Config};
|
||||
use solana_core::gossip_service::{discover_cluster, get_multi_client};
|
||||
use solana_core::validator::ValidatorConfig;
|
||||
use solana_drone::drone::run_local_drone;
|
||||
use solana_exchange_api::exchange_processor::process_instruction;
|
||||
use solana_exchange_api::id;
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_runtime::bank_client::BankClient;
|
||||
use solana_sdk::genesis_block::create_genesis_block;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use std::process::exit;
|
||||
use std::sync::mpsc::channel;
|
||||
use std::time::Duration;
|
||||
|
||||
#[test]
|
||||
fn test_exchange_local_cluster() {
|
||||
solana_logger::setup();
|
||||
|
||||
const NUM_NODES: usize = 1;
|
||||
|
||||
let mut config = Config::default();
|
||||
config.identity = Keypair::new();
|
||||
config.duration = Duration::from_secs(1);
|
||||
config.fund_amount = 100_000;
|
||||
config.threads = 1;
|
||||
config.transfer_delay = 20; // 15
|
||||
config.batch_size = 100; // 1000;
|
||||
config.chunk_size = 10; // 200;
|
||||
config.account_groups = 1; // 10;
|
||||
let Config {
|
||||
fund_amount,
|
||||
batch_size,
|
||||
account_groups,
|
||||
..
|
||||
} = config;
|
||||
let accounts_in_groups = batch_size * account_groups;
|
||||
|
||||
let cluster = LocalCluster::new(&ClusterConfig {
|
||||
node_stakes: vec![100_000; NUM_NODES],
|
||||
cluster_lamports: 100_000_000_000_000,
|
||||
validator_configs: vec![ValidatorConfig::default(); NUM_NODES],
|
||||
native_instruction_processors: [solana_exchange_program!()].to_vec(),
|
||||
..ClusterConfig::default()
|
||||
});
|
||||
|
||||
let drone_keypair = Keypair::new();
|
||||
cluster.transfer(
|
||||
&cluster.funding_keypair,
|
||||
&drone_keypair.pubkey(),
|
||||
2_000_000_000_000,
|
||||
);
|
||||
|
||||
let (addr_sender, addr_receiver) = channel();
|
||||
run_local_drone(drone_keypair, addr_sender, Some(1_000_000_000_000));
|
||||
let drone_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap();
|
||||
|
||||
info!("Connecting to the cluster");
|
||||
let (nodes, _) =
|
||||
discover_cluster(&cluster.entry_point_info.gossip, NUM_NODES).unwrap_or_else(|err| {
|
||||
error!("Failed to discover {} nodes: {:?}", NUM_NODES, err);
|
||||
exit(1);
|
||||
});
|
||||
|
||||
let (client, num_clients) = get_multi_client(&nodes);
|
||||
|
||||
info!("clients: {}", num_clients);
|
||||
assert!(num_clients >= NUM_NODES);
|
||||
|
||||
const NUM_SIGNERS: u64 = 2;
|
||||
airdrop_lamports(
|
||||
&client,
|
||||
&drone_addr,
|
||||
&config.identity,
|
||||
fund_amount * (accounts_in_groups + 1) as u64 * NUM_SIGNERS,
|
||||
);
|
||||
|
||||
do_bench_exchange(vec![client], config);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exchange_bank_client() {
|
||||
solana_logger::setup();
|
||||
let (genesis_block, identity) = create_genesis_block(100_000_000_000_000);
|
||||
let mut bank = Bank::new(&genesis_block);
|
||||
bank.add_instruction_processor(id(), process_instruction);
|
||||
let clients = vec![BankClient::new(bank)];
|
||||
|
||||
let mut config = Config::default();
|
||||
config.identity = identity;
|
||||
config.duration = Duration::from_secs(1);
|
||||
config.fund_amount = 100_000;
|
||||
config.threads = 1;
|
||||
config.transfer_delay = 20; // 0;
|
||||
config.batch_size = 100; // 1500;
|
||||
config.chunk_size = 10; // 1500;
|
||||
config.account_groups = 1; // 50;
|
||||
|
||||
do_bench_exchange(clients, config);
|
||||
}
|
76
local_cluster/src/tests/bench_tps.rs
Normal file
76
local_cluster/src/tests/bench_tps.rs
Normal file
@ -0,0 +1,76 @@
|
||||
use crate::local_cluster::{ClusterConfig, LocalCluster};
|
||||
use serial_test_derive::serial;
|
||||
use solana_bench_tps::bench::{do_bench_tps, generate_and_fund_keypairs};
|
||||
use solana_bench_tps::cli::Config;
|
||||
use solana_client::thin_client::create_client;
|
||||
use solana_core::cluster_info::FULLNODE_PORT_RANGE;
|
||||
use solana_core::validator::ValidatorConfig;
|
||||
use solana_drone::drone::run_local_drone;
|
||||
use solana_move_loader_program;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use std::sync::mpsc::channel;
|
||||
use std::time::Duration;
|
||||
|
||||
fn test_bench_tps_local_cluster(config: Config) {
|
||||
solana_logger::setup();
|
||||
const NUM_NODES: usize = 1;
|
||||
let cluster = LocalCluster::new(&ClusterConfig {
|
||||
node_stakes: vec![999_990; NUM_NODES],
|
||||
cluster_lamports: 200_000_000,
|
||||
validator_configs: vec![ValidatorConfig::default(); NUM_NODES],
|
||||
native_instruction_processors: vec![solana_move_loader_program!()],
|
||||
..ClusterConfig::default()
|
||||
});
|
||||
|
||||
let drone_keypair = Keypair::new();
|
||||
cluster.transfer(
|
||||
&cluster.funding_keypair,
|
||||
&drone_keypair.pubkey(),
|
||||
100_000_000,
|
||||
);
|
||||
|
||||
let client = create_client(
|
||||
(cluster.entry_point_info.rpc, cluster.entry_point_info.tpu),
|
||||
FULLNODE_PORT_RANGE,
|
||||
);
|
||||
|
||||
let (addr_sender, addr_receiver) = channel();
|
||||
run_local_drone(drone_keypair, addr_sender, None);
|
||||
let drone_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap();
|
||||
|
||||
let lamports_per_account = 100;
|
||||
|
||||
let (keypairs, move_keypairs, _keypair_balance) = generate_and_fund_keypairs(
|
||||
&client,
|
||||
Some(drone_addr),
|
||||
&config.id,
|
||||
config.tx_count,
|
||||
lamports_per_account,
|
||||
config.use_move,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let total = do_bench_tps(vec![client], config, keypairs, 0, move_keypairs);
|
||||
assert!(total > 100);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_bench_tps_local_cluster_solana() {
|
||||
let mut config = Config::default();
|
||||
config.tx_count = 100;
|
||||
config.duration = Duration::from_secs(10);
|
||||
|
||||
test_bench_tps_local_cluster(config);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_bench_tps_local_cluster_move() {
|
||||
let mut config = Config::default();
|
||||
config.tx_count = 100;
|
||||
config.duration = Duration::from_secs(20);
|
||||
config.use_move = true;
|
||||
|
||||
test_bench_tps_local_cluster(config);
|
||||
}
|
@ -1,16 +1,14 @@
|
||||
extern crate solana_core;
|
||||
|
||||
use crate::{
|
||||
cluster::Cluster,
|
||||
cluster_tests,
|
||||
local_cluster::{ClusterConfig, LocalCluster},
|
||||
};
|
||||
use log::*;
|
||||
use serial_test_derive::serial;
|
||||
use solana_core::{
|
||||
bank_forks::SnapshotConfig, blocktree::Blocktree, broadcast_stage::BroadcastStageType,
|
||||
gossip_service::discover_cluster, snapshot_utils, validator::ValidatorConfig,
|
||||
};
|
||||
use solana_local_cluster::cluster::Cluster;
|
||||
use solana_local_cluster::{
|
||||
cluster_tests,
|
||||
local_cluster::{ClusterConfig, LocalCluster},
|
||||
};
|
||||
use solana_runtime::{
|
||||
accounts_db::AccountsDB,
|
||||
epoch_schedule::{EpochSchedule, MINIMUM_SLOTS_PER_EPOCH},
|
||||
@ -584,7 +582,6 @@ fn test_faulty_node(faulty_node_type: BroadcastStageType) {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_repairman_catchup() {
|
||||
solana_logger::setup();
|
||||
error!("test_repairman_catchup");
|
@ -1,9 +1,4 @@
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
#[macro_use]
|
||||
extern crate solana_core;
|
||||
|
||||
use crate::local_cluster::{ClusterConfig, LocalCluster};
|
||||
use serial_test_derive::serial;
|
||||
use solana_client::thin_client::create_client;
|
||||
use solana_core::blocktree::{create_new_tmp_ledger, get_tmp_ledger_path, Blocktree};
|
||||
@ -13,7 +8,6 @@ use solana_core::gossip_service::discover_cluster;
|
||||
use solana_core::replicator::Replicator;
|
||||
use solana_core::storage_stage::SLOTS_PER_TURN_TEST;
|
||||
use solana_core::validator::ValidatorConfig;
|
||||
use solana_local_cluster::local_cluster::{ClusterConfig, LocalCluster};
|
||||
use solana_sdk::genesis_block::create_genesis_block;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use std::fs::remove_dir_all;
|
Reference in New Issue
Block a user