Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: cargo test --release --all-targets --all-features --workspace --exclude integration-tests

- name: Run integration tests
run: cargo test --release --test cucumber
run: cargo test --release --test cucumber -- -t "not @benchmark"

- name: Check unused dependencies
run: cargo machete
1 change: 0 additions & 1 deletion integration-tests/features/fund_locking.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Feature: Fund Locking
When I lock funds with duration "7200" seconds
Then the UTXOs should be locked for "7200" seconds

@pie
Scenario: Lock funds with insufficient balance
Given I have a test database with an existing wallet
And the wallet has zero balance
Expand Down
19 changes: 19 additions & 0 deletions integration-tests/features/wallet_benchmark.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature: Wallet Performance Benchmarking
As a developer
I want to benchmark wallet performance
So that I can measure scanning and transaction confirmation times

@benchmark
Scenario: Benchmark wallet scanning and transaction confirmation performance
Given I have a seed node BenchmarkNode
And I have a test database with an existing wallet
When I mine 1000 blocks on BenchmarkNode
Then I measure the time to scan 1000 blocks
Then the scan should complete successfully
When I check the balance for account "default"
Then the balance should be at least 1753895088580 microTari
When I send 500 transactions
And I mine 5 blocks on BenchmarkNode
And I measure the time to confirm 500 transactions
Then 500 transactions of 1000 uT should be confirmed
Then I print the benchmark results
25 changes: 25 additions & 0 deletions integration-tests/steps/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ pub struct MinotariWorld {
pub assigned_ports: IndexMap<u64, u64>,
pub current_base_dir: Option<PathBuf>,
pub seed_nodes: Vec<String>,
pub benchmark_timings: HashMap<String, std::time::Duration>,
pub pre_send_balance: Option<u64>,
}

impl MinotariWorld {
Expand Down Expand Up @@ -71,6 +73,8 @@ impl MinotariWorld {
assigned_ports: IndexMap::new(),
current_base_dir: Some(base_dir),
seed_nodes: Vec::new(),
benchmark_timings: HashMap::new(),
pre_send_balance: None,
}
}

Expand Down Expand Up @@ -166,6 +170,27 @@ impl MinotariWorld {
pub fn all_seed_nodes(&self) -> &[String] {
&self.seed_nodes
}

/// Run the balance command and return the balance in microTari
pub fn fetch_balance(&mut self) -> u64 {
let db_path = self.database_path.as_ref().expect("Database not set up").clone();
let (cmd, mut args) = self.get_minotari_command();
args.extend_from_slice(&[
"balance".to_string(),
"--database-path".to_string(),
db_path.to_str().unwrap().to_string(),
"--account-name".to_string(),
"default".to_string(),
]);

let output = std::process::Command::new(&cmd)
.args(&args)
.output()
.expect("Failed to execute balance command");

self.last_command_output = Some(String::from_utf8_lossy(&output.stdout).to_string());
self.parse_balance_from_output().expect("Could not parse balance")
}
}

impl Drop for MinotariWorld {
Expand Down
1 change: 1 addition & 0 deletions integration-tests/steps/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub mod daemon;
pub mod fund_locking;
pub mod scanning;
pub mod transactions;
pub mod wallet_benchmark;
pub mod wallet_creation;
pub mod wallet_import;

Expand Down
Loading
Loading