Skip to content

Commit

Permalink
New forge test
Browse files Browse the repository at this point in the history
  • Loading branch information
bchocho committed Dec 5, 2024
1 parent add8b32 commit e05d73a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 deletions.
4 changes: 1 addition & 3 deletions testsuite/forge-cli/src/suites/land_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ pub(crate) fn get_land_blocking_test(
test_cmd: &TestCommand,
) -> Option<ForgeConfig> {
let test = match test_name {
"land_blocking" | "realistic_env_max_load" => {
realistic_env_max_load_test(duration, test_cmd, 7, 5)
},
"removed" => realistic_env_max_load_test(duration, test_cmd, 7, 5),
"compat" => compat(),
"framework_upgrade" => framework_upgrade(),
_ => return None, // The test name does not match a land-blocking test
Expand Down
18 changes: 18 additions & 0 deletions testsuite/forge-cli/src/suites/realistic_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub(crate) fn get_realistic_env_test(
"realistic_env_graceful_workload_sweep" => realistic_env_graceful_workload_sweep(),
"realistic_env_graceful_overload" => realistic_env_graceful_overload(duration),
"realistic_network_tuned_for_throughput" => realistic_network_tuned_for_throughput_test(),
"land_blocking" | "realistic_env_max_load" => bcho_test(),
_ => return None, // The test name does not match a realistic-env test
};
Some(test)
Expand Down Expand Up @@ -108,6 +109,23 @@ pub(crate) fn realistic_env_load_sweep_test() -> ForgeConfig {
})
}

pub(crate) fn bcho_test() -> ForgeConfig {
realistic_env_sweep_wrap(7, 3, LoadVsPerfBenchmark {
test: Box::new(PerformanceBenchmark),
workloads: Workloads::TRANSACTIONS(vec![
// Sequential workload
TransactionWorkload::new(TransactionTypeArg::SmartTablePicture1MWith256Change, 50)
.with_gas_price(5 * aptos_global_constants::GAS_UNIT_PRICE)
.with_transactions_per_account(50),
]),
criteria: Vec::new(),
background_traffic: background_traffic_for_sweep_with_latency(&[
(3.0, 8.0),
(3.0, 8.0),
(3.0, 4.0),
]),
})
}
pub(crate) fn realistic_env_workload_sweep_test() -> ForgeConfig {
realistic_env_sweep_wrap(7, 3, LoadVsPerfBenchmark {
test: Box::new(PerformanceBenchmark),
Expand Down
4 changes: 2 additions & 2 deletions testsuite/forge-cli/src/suites/ungrouped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ fn consensus_stress_test() -> ForgeConfig {
fn background_emit_request() -> EmitJobRequest {
EmitJobRequest::default()
.num_accounts_mode(NumAccountsMode::TransactionsPerAccount(1))
.mode(EmitJobMode::ConstTps { tps: 10 })
.gas_price(5 * aptos_global_constants::GAS_UNIT_PRICE)
.mode(EmitJobMode::ConstTps { tps: 1000 })
.gas_price(aptos_global_constants::GAS_UNIT_PRICE)
}

pub fn background_traffic_for_sweep(num_cases: usize) -> Option<BackgroundTraffic> {
Expand Down
31 changes: 31 additions & 0 deletions testsuite/testcases/src/load_vs_perf_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ pub struct TransactionWorkload {
pub unique_senders: bool,
pub load: EmitJobMode,
pub transactions_per_account_override: Option<usize>,
pub num_accounts_override: Option<usize>,
pub gas_price_override: Option<u64>,
}

impl TransactionWorkload {
Expand All @@ -125,6 +127,8 @@ impl TransactionWorkload {
unique_senders: false,
load: EmitJobMode::MaxLoad { mempool_backlog },
transactions_per_account_override: None,
num_accounts_override: None,
gas_price_override: None,
}
}

Expand All @@ -135,6 +139,8 @@ impl TransactionWorkload {
unique_senders: false,
load: EmitJobMode::ConstTps { tps },
transactions_per_account_override: None,
num_accounts_override: None,
gas_price_override: None,
}
}

Expand All @@ -154,6 +160,8 @@ impl TransactionWorkload {
num_waves,
},
transactions_per_account_override: None,
num_accounts_override: None,
gas_price_override: None,
}
}

Expand All @@ -172,6 +180,16 @@ impl TransactionWorkload {
self
}

pub fn with_num_accounts(mut self, num_accounts: usize) -> Self {
self.num_accounts_override = Some(num_accounts);
self
}

pub fn with_gas_price(mut self, gas_price: u64) -> Self {
self.gas_price_override = Some(gas_price);
self
}

fn is_phased(&self) -> bool {
self.unique_senders
}
Expand All @@ -182,12 +200,25 @@ impl TransactionWorkload {

let mut request = request.mode(self.load.clone());

assert!(
!(self.transactions_per_account_override.is_some()
&& self.num_accounts_override.is_some())
);

if let Some(transactions_per_account) = &self.transactions_per_account_override {
request = request.num_accounts_mode(NumAccountsMode::TransactionsPerAccount(
*transactions_per_account,
))
}

if let Some(num_accounts) = &self.num_accounts_override {
request = request.num_accounts_mode(NumAccountsMode::NumAccounts(*num_accounts))
}

if let Some(gas_price) = &self.gas_price_override {
request = request.gas_price(*gas_price)
}

if self.is_phased() {
let write_type = self.transaction_type.materialize(
self.num_modules,
Expand Down

0 comments on commit e05d73a

Please sign in to comment.