Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
8f4796b
introduce run_local_faucet_for_tests / run_local_Faucet_with_config
puhtaytow Sep 5, 2025
f74b3df
migrate to use new run_local_faucet_for_tests
puhtaytow Sep 5, 2025
a07188c
migrate to new run_local_faucet_for_tests
puhtaytow Sep 5, 2025
5574870
migrate tests to run_local_faucet_for_tests / non-overlapping ports
puhtaytow Sep 5, 2025
a604dd6
introduce helper run_local_faucet
puhtaytow Sep 5, 2025
5a62717
migrate address_lookup_table tests to local faucet / non-overlapping …
puhtaytow Sep 5, 2025
dd7e288
migrate cluster_query tests to local faucet / non-overlapping ports
puhtaytow Sep 5, 2025
2c2c850
migrate nonce tests to local faucet / non-overlapping ports
puhtaytow Sep 5, 2025
9e4afb8
migrate program tests to local cluster / non-overlapping ports
puhtaytow Sep 5, 2025
cf052c4
migrate request_airdrop to local_cluster / non-overlapping ports
puhtaytow Sep 5, 2025
7d3ddca
migrate stake tests to local faucet / non-overlapping ports
puhtaytow Sep 5, 2025
6fd2e8b
migrate transfer tests to local faucet / non-overlapping ports
puhtaytow Sep 5, 2025
ab9119c
migrate validator_info tests to local faucet / non-overlapping ports
puhtaytow Sep 5, 2025
c762485
migrate vote tests to local cluster / non-overlapping ports
puhtaytow Sep 5, 2025
beffc91
migrate local faucet test to new api
puhtaytow Sep 5, 2025
a12b7ee
change name of run_local_faucet to be more explicit / extend docs
puhtaytow Sep 7, 2025
e556d4c
move helper function from cli/test_utils to faucet / DCOU
puhtaytow Sep 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion accounts-cluster-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jemallocator = { workspace = true }
[dev-dependencies]
solana-accounts-db = { workspace = true }
solana-core = { workspace = true, features = ["dev-context-only-utils"] }
solana-faucet = { workspace = true }
solana-faucet = { workspace = true, features = ["dev-context-only-utils"] }
solana-local-cluster = { workspace = true, features = ["dev-context-only-utils"] }
solana-native-token = { workspace = true }
solana-poh-config = { workspace = true }
Expand Down
8 changes: 6 additions & 2 deletions accounts-cluster-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ pub mod test {
super::*,
solana_accounts_db::accounts_index::{AccountIndex, AccountSecondaryIndexes},
solana_core::validator::ValidatorConfig,
solana_faucet::faucet::run_local_faucet,
solana_faucet::faucet::run_local_faucet_for_tests,
solana_local_cluster::{
local_cluster::{ClusterConfig, LocalCluster},
validator_configs::make_identical_validator_configs,
Expand Down Expand Up @@ -1533,7 +1533,11 @@ pub mod test {
solana_logger::setup();
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_for_tests(
mint_keypair,
None, /* per_time_cap */
0, /* port */
);
let test_validator = TestValidator::with_custom_fees(
mint_pubkey,
1,
Expand Down
2 changes: 1 addition & 1 deletion bench-tps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ solana-commitment-config = { workspace = true }
solana-compute-budget-interface = { workspace = true }
solana-connection-cache = { workspace = true }
solana-core = { workspace = true, features = ["dev-context-only-utils"] }
solana-faucet = { workspace = true }
solana-fee-calculator = { workspace = true }
solana-genesis = { workspace = true }
solana-genesis-config = { workspace = true }
Expand Down Expand Up @@ -76,6 +75,7 @@ jemallocator = { workspace = true }
[dev-dependencies]
agave-feature-set = { workspace = true }
serial_test = { workspace = true }
solana-faucet = { workspace = true, features = ["dev-context-only-utils"] }
Comment thread
puhtaytow marked this conversation as resolved.
solana-local-cluster = { workspace = true }
solana-rent = { workspace = true }
solana-runtime = { workspace = true, features = ["dev-context-only-utils"] }
Expand Down
15 changes: 11 additions & 4 deletions bench-tps/tests/bench_tps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use {
solana_commitment_config::CommitmentConfig,
solana_connection_cache::connection_cache::NewConnectionConfig,
solana_core::validator::ValidatorConfig,
solana_faucet::faucet::run_local_faucet,
solana_faucet::faucet::run_local_faucet_for_tests,
solana_fee_calculator::FeeRateGovernor,
solana_keypair::Keypair,
solana_local_cluster::{
Expand Down Expand Up @@ -51,7 +51,11 @@ fn test_bench_tps_local_cluster(config: Config) {

let faucet_keypair = Keypair::new();
let faucet_pubkey = faucet_keypair.pubkey();
let faucet_addr = run_local_faucet(faucet_keypair, None);
let faucet_addr = run_local_faucet_for_tests(
faucet_keypair,
None, /* per_time_cap */
0, /* port */
);

const NUM_NODES: usize = 1;
let cluster = LocalCluster::new(
Expand Down Expand Up @@ -109,8 +113,11 @@ fn test_bench_tps_test_validator(config: Config) {

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();

let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_for_tests(
mint_keypair,
None, /* per_time_cap */
0, /* port */
);

let test_validator = TestValidatorGenesis::default()
.fee_rate_governor(FeeRateGovernor::new(0, 0))
Expand Down
5 changes: 2 additions & 3 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ name = "solana"
path = "src/main.rs"

[features]
dev-context-only-utils = []
dev-context-only-utils = ["solana-faucet/dev-context-only-utils"]

[dependencies]
agave-feature-set = { workspace = true }
Expand Down Expand Up @@ -103,9 +103,8 @@ tiny-bip39 = { workspace = true }

[dev-dependencies]
assert_matches = { workspace = true }
solana-cli = { path = ".", features = ["dev-context-only-utils"] }
solana-client = { workspace = true, features = ["dev-context-only-utils"] }
solana-faucet = { workspace = true }
Comment thread
puhtaytow marked this conversation as resolved.
solana-faucet = { workspace = true, features = ["dev-context-only-utils"] }
solana-nonce-account = { workspace = true }
solana-presigner = { workspace = true }
solana-rpc = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions cli/tests/address_lookup_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
cli::{process_command, CliCommand, CliConfig},
},
solana_cli_output::{CliAddressLookupTable, CliAddressLookupTableCreated, OutputFormat},
solana_faucet::faucet::run_local_faucet,
solana_faucet::faucet::run_local_faucet_with_unique_port_for_tests,
solana_keypair::Keypair,
solana_native_token::LAMPORTS_PER_SOL,
solana_pubkey::Pubkey,
Expand All @@ -21,7 +21,7 @@ use {
fn test_cli_create_extend_and_freeze_address_lookup_table() {
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down Expand Up @@ -135,7 +135,7 @@ fn test_cli_create_extend_and_freeze_address_lookup_table() {
fn test_cli_create_and_deactivate_address_lookup_table() {
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down
4 changes: 2 additions & 2 deletions cli/tests/cluster_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use {
test_utils::check_ready,
},
solana_commitment_config::CommitmentConfig,
solana_faucet::faucet::run_local_faucet,
solana_faucet::faucet::run_local_faucet_with_unique_port_for_tests,
solana_fee_structure::FeeStructure,
solana_keypair::Keypair,
solana_native_token::LAMPORTS_PER_SOL,
Expand All @@ -24,7 +24,7 @@ fn test_ping(compute_unit_price: Option<u64>) {
let fee = FeeStructure::default().get_max_fee(1, 0);
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator = TestValidator::with_custom_fees(
mint_pubkey,
fee,
Expand Down
6 changes: 3 additions & 3 deletions cli/tests/nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use {
},
solana_cli_output::{parse_sign_only_reply_string, OutputFormat},
solana_commitment_config::CommitmentConfig,
solana_faucet::faucet::run_local_faucet,
solana_faucet::faucet::run_local_faucet_with_unique_port_for_tests,
solana_hash::Hash,
solana_keypair::{keypair_from_seed, Keypair},
solana_native_token::LAMPORTS_PER_SOL,
Expand All @@ -29,7 +29,7 @@ use {
fn test_nonce(seed: Option<String>, use_nonce_authority: bool, compute_unit_price: Option<u64>) {
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down Expand Up @@ -218,7 +218,7 @@ fn test_create_account_with_seed() {
solana_logger::setup();
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator = TestValidator::with_custom_fees(
mint_pubkey,
ONE_SIG_FEE,
Expand Down
8 changes: 5 additions & 3 deletions cli/tests/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use {
solana_client::rpc_config::RpcSendTransactionConfig,
solana_commitment_config::CommitmentConfig,
solana_compute_budget_interface::ComputeBudgetInstruction,
solana_faucet::faucet::run_local_faucet,
solana_faucet::faucet::run_local_faucet_with_unique_port_for_tests,
solana_fee_calculator::FeeRateGovernor,
solana_keypair::Keypair,
solana_loader_v3_interface::state::UpgradeableLoaderState,
Expand Down Expand Up @@ -56,7 +56,9 @@ fn test_validator_genesis(mint_keypair: Keypair) -> TestValidatorGenesis {
exemption_threshold: 1.0,
..Rent::default()
})
.faucet_addr(Some(run_local_faucet(mint_keypair, None)));
.faucet_addr(Some(run_local_faucet_with_unique_port_for_tests(
mint_keypair,
)));
genesis
}

Expand Down Expand Up @@ -2929,7 +2931,7 @@ fn test_cli_program_deploy_with_args(compute_unit_price: Option<u64>, use_rpc: b

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator = TestValidatorGenesis::default()
.fee_rate_governor(FeeRateGovernor::new(0, 0))
.rent(Rent {
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/request_airdrop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use {
solana_cli::cli::{process_command, CliCommand, CliConfig},
solana_commitment_config::CommitmentConfig,
solana_faucet::faucet::run_local_faucet,
solana_faucet::faucet::run_local_faucet_with_unique_port_for_tests,
solana_keypair::Keypair,
solana_native_token::LAMPORTS_PER_SOL,
solana_rpc_client::rpc_client::RpcClient,
Expand All @@ -15,7 +15,7 @@ use {
fn test_cli_request_airdrop() {
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down
28 changes: 14 additions & 14 deletions cli/tests/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use {
solana_cli_output::{parse_sign_only_reply_string, OutputFormat},
solana_commitment_config::CommitmentConfig,
solana_epoch_schedule::EpochSchedule,
solana_faucet::faucet::run_local_faucet,
solana_faucet::faucet::run_local_faucet_with_unique_port_for_tests,
solana_fee_calculator::FeeRateGovernor,
solana_fee_structure::FeeStructure,
solana_keypair::{keypair_from_seed, Keypair},
Expand All @@ -39,7 +39,7 @@ fn test_stake_delegation_force() {
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let authorized_withdrawer = Keypair::new().pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let slots_per_epoch = 32;
let test_validator = TestValidatorGenesis::default()
.fee_rate_governor(FeeRateGovernor::new(0, 0))
Expand Down Expand Up @@ -204,7 +204,7 @@ fn test_seed_stake_delegation_and_deactivation(compute_unit_price: Option<u64>)

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down Expand Up @@ -299,7 +299,7 @@ fn test_stake_delegation_and_withdraw_available() {

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down Expand Up @@ -468,7 +468,7 @@ fn test_stake_delegation_and_withdraw_all() {

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down Expand Up @@ -633,7 +633,7 @@ fn test_stake_delegation_and_deactivation(compute_unit_price: Option<u64>) {

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down Expand Up @@ -725,7 +725,7 @@ fn test_offline_stake_delegation_and_deactivation(compute_unit_price: Option<u64

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down Expand Up @@ -885,7 +885,7 @@ fn test_nonced_stake_delegation_and_deactivation(compute_unit_price: Option<u64>

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down Expand Up @@ -1014,7 +1014,7 @@ fn test_stake_authorize(compute_unit_price: Option<u64>) {

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down Expand Up @@ -1344,7 +1344,7 @@ fn test_stake_authorize_with_fee_payer() {

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator = TestValidator::with_custom_fees(
mint_pubkey,
fee_one_sig,
Expand Down Expand Up @@ -1524,7 +1524,7 @@ fn test_stake_split(compute_unit_price: Option<u64>) {

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator = TestValidator::with_custom_fees(
mint_pubkey,
1,
Expand Down Expand Up @@ -1685,7 +1685,7 @@ fn test_stake_set_lockup(compute_unit_price: Option<u64>) {

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator = TestValidator::with_custom_fees(
mint_pubkey,
1,
Expand Down Expand Up @@ -1973,7 +1973,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw(compute_unit_price: Opt

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down Expand Up @@ -2216,7 +2216,7 @@ fn test_stake_checked_instructions() {

let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let faucet_addr = run_local_faucet_with_unique_port_for_tests(mint_keypair);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);

Expand Down
Loading
Loading