-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from input-output-hk/load_tests
Backend Load tests
- Loading branch information
Showing
11 changed files
with
483 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,5 @@ cfg-if = "1.0.0" | |
assert_fs = "1.0" | ||
|
||
[features] | ||
non-functional = [] | ||
load-tests = [] | ||
soak-tests = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
use crate::non_functional::build_load_config; | ||
use crate::non_functional::private_vote_test_scenario; | ||
use crate::setup::vitup_setup; | ||
use assert_fs::TempDir; | ||
use iapyx::{IapyxLoad, Protocol}; | ||
use jormungandr_testing_utils::testing::node::time; | ||
use jortestkit::measurement::Status; | ||
use vit_servicing_station_tests::common::data::ArbitraryValidVotingTemplateGenerator; | ||
use vitup::scenario::network::setup_network; | ||
use vitup::setup::start::quick::QuickVitBackendSettingsBuilder; | ||
|
||
#[tokio::test] | ||
pub async fn load_test_public_100_000_votes() { | ||
let testing_directory = TempDir::new().unwrap().into_persistent(); | ||
let endpoint = "127.0.0.1:8080"; | ||
|
||
let no_of_votes = 100_000; | ||
let no_of_threads = 10; | ||
let no_of_wallets = 4_000; | ||
|
||
let mut quick_setup = QuickVitBackendSettingsBuilder::new(); | ||
quick_setup | ||
.initials_count(no_of_wallets, "1234") | ||
.vote_start_epoch(0) | ||
.tally_start_epoch(3) | ||
.tally_end_epoch(4) | ||
.slot_duration_in_seconds(2) | ||
.slots_in_epoch_count(60) | ||
.proposals_count(250) | ||
.voting_power(31_000) | ||
.private(false); | ||
|
||
let mut template_generator = ArbitraryValidVotingTemplateGenerator::new(); | ||
let (mut vit_controller, mut controller, vit_parameters, fund_name) = | ||
vitup_setup(quick_setup, testing_directory.path().to_path_buf()); | ||
|
||
let (nodes, vit_station, wallet_proxy) = setup_network( | ||
&mut controller, | ||
&mut vit_controller, | ||
vit_parameters, | ||
&mut template_generator, | ||
endpoint.to_string(), | ||
&Protocol::Http, | ||
) | ||
.unwrap(); | ||
|
||
let mut qr_codes_folder = testing_directory.path().to_path_buf(); | ||
qr_codes_folder.push("vit_backend/qr-codes"); | ||
|
||
let config = build_load_config(endpoint, qr_codes_folder, no_of_threads, no_of_votes); | ||
let iapyx_load = IapyxLoad::new(config); | ||
if let Some(benchmark) = iapyx_load.start().unwrap() { | ||
assert!(benchmark.status() == Status::Green, "too low efficiency"); | ||
} | ||
|
||
println!( | ||
"{:?}", | ||
nodes | ||
.get(0) | ||
.unwrap() | ||
.explorer() | ||
.status() | ||
.unwrap() | ||
.data | ||
.unwrap() | ||
.status | ||
); | ||
|
||
time::wait_for_epoch(10, nodes.get(0).unwrap().explorer()); | ||
|
||
let mut committee = controller.wallet("committee").unwrap(); | ||
let vote_plan = controller.vote_plan(&fund_name).unwrap(); | ||
|
||
controller | ||
.fragment_sender() | ||
.send_public_vote_tally(&mut committee, &vote_plan.into(), nodes.get(0).unwrap()) | ||
.unwrap(); | ||
|
||
vit_station.shutdown(); | ||
wallet_proxy.shutdown(); | ||
for node in nodes { | ||
node.logger() | ||
.assert_no_errors(&format!("Errors in logs for node: {}", node.alias())); | ||
node.shutdown().unwrap(); | ||
} | ||
|
||
controller.finalize(); | ||
} | ||
|
||
#[tokio::test] | ||
pub async fn load_test_private_pesimistic() { | ||
let no_of_votes = 30_000; | ||
let no_of_threads = 10; | ||
let no_of_wallets = 4_000; | ||
let endpoint = "127.0.0.1:8080"; | ||
|
||
let mut quick_setup = QuickVitBackendSettingsBuilder::new(); | ||
quick_setup | ||
.initials_count(no_of_wallets, "1234") | ||
.vote_start_epoch(0) | ||
.tally_start_epoch(3) | ||
.tally_end_epoch(4) | ||
.slot_duration_in_seconds(2) | ||
.slots_in_epoch_count(60) | ||
.proposals_count(250) | ||
.voting_power(31_000) | ||
.private(true); | ||
|
||
private_vote_test_scenario(quick_setup, endpoint, no_of_votes, no_of_threads); | ||
} | ||
|
||
#[tokio::test] | ||
pub async fn load_test_private_optimistic() { | ||
let no_of_votes = 100_000; | ||
let no_of_threads = 10; | ||
let no_of_wallets = 20_000; | ||
let endpoint = "127.0.0.1:8080"; | ||
|
||
let mut quick_setup = QuickVitBackendSettingsBuilder::new(); | ||
quick_setup | ||
.initials_count(no_of_wallets, "1234") | ||
.vote_start_epoch(0) | ||
.tally_start_epoch(6) | ||
.tally_end_epoch(7) | ||
.slot_duration_in_seconds(2) | ||
.slots_in_epoch_count(60) | ||
.proposals_count(250) | ||
.voting_power(31_000) | ||
.private(true); | ||
|
||
private_vote_test_scenario(quick_setup, endpoint, no_of_votes, no_of_threads); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.