-
Notifications
You must be signed in to change notification settings - Fork 132
/
fragment.rs
164 lines (141 loc) · 4.87 KB
/
fragment.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
use crate::common::jormungandr::ConfigurationBuilder;
use crate::common::startup;
use jormungandr_lib::interfaces::BlockDate;
use jormungandr_lib::interfaces::{ActiveSlotCoefficient, KesUpdateSpeed};
use jormungandr_testing_utils::testing::fragments::TransactionGenerator;
use jormungandr_testing_utils::testing::node::time;
use jormungandr_testing_utils::testing::FragmentSender;
use jormungandr_testing_utils::testing::{
BatchFragmentGenerator, FragmentGenerator, FragmentSenderSetup, FragmentStatusProvider,
};
pub use jortestkit::console::progress_bar::{parse_progress_bar_mode_from_str, ProgressBarMode};
use jortestkit::load::{self, Configuration, Monitor};
use jortestkit::prelude::Wait;
use std::time::Duration;
#[test]
pub fn fragment_load_test() {
let faucet = startup::create_new_account_address();
let receiver = startup::create_new_account_address();
let (mut jormungandr, _) = startup::start_stake_pool(
&[faucet.clone()],
&[receiver.clone()],
ConfigurationBuilder::new()
.with_slots_per_epoch(30)
.with_consensus_genesis_praos_active_slot_coeff(ActiveSlotCoefficient::MAXIMUM)
.with_slot_duration(4)
.with_epoch_stability_depth(10)
.with_kes_update_speed(KesUpdateSpeed::new(43200).unwrap()),
)
.unwrap();
jormungandr.steal_temp_dir().unwrap().into_persistent();
let configuration = Configuration::duration(
1,
std::time::Duration::from_secs(60),
500,
Monitor::Standard(1000),
1_000,
1_000,
);
let mut request_generator = FragmentGenerator::new(
faucet,
receiver,
jormungandr.to_remote(),
60,
30,
30,
FragmentSender::new(
jormungandr.genesis_block_hash(),
jormungandr.fees(),
FragmentSenderSetup::no_verify(),
),
);
use crate::common::jcli::FragmentsCheck;
use crate::common::jcli::JCli;
request_generator.prepare(BlockDate::new(0, 19));
let jcli: JCli = Default::default();
let fragment_check = FragmentsCheck::new(jcli, &jormungandr);
let wait = Wait::new(Duration::from_secs(1), 25);
fragment_check.wait_until_all_processed(&wait).unwrap();
time::wait_for_epoch(1, jormungandr.rest());
load::start_async(
request_generator,
FragmentStatusProvider::new(jormungandr.to_remote()),
configuration,
"Wallet backend load test",
);
}
#[test]
pub fn fragment_batch_load_test() {
let mut faucet = startup::create_new_account_address();
let (mut jormungandr, _) = startup::start_stake_pool(
&[faucet.clone()],
&[],
ConfigurationBuilder::new()
.with_slots_per_epoch(60)
.with_consensus_genesis_praos_active_slot_coeff(ActiveSlotCoefficient::MAXIMUM)
.with_slot_duration(4)
.with_epoch_stability_depth(10)
.with_kes_update_speed(KesUpdateSpeed::new(43200).unwrap()),
)
.unwrap();
jormungandr.steal_temp_dir().unwrap().into_persistent();
let configuration = Configuration::duration(
5,
std::time::Duration::from_secs(60),
1000,
Monitor::Standard(100),
3_000,
1_000,
);
let mut request_generator = BatchFragmentGenerator::new(
FragmentSenderSetup::no_verify(),
jormungandr.to_remote(),
jormungandr.genesis_block_hash(),
jormungandr.fees(),
10,
);
request_generator.fill_from_faucet(&mut faucet);
load::start_async(
request_generator,
FragmentStatusProvider::new(jormungandr.to_remote()),
configuration,
"Wallet backend load test",
);
}
#[test]
pub fn transaction_load_test() {
let mut faucet = startup::create_new_account_address();
let (mut jormungandr, _) = startup::start_stake_pool(
&[faucet.clone()],
&[],
ConfigurationBuilder::new()
.with_slots_per_epoch(60)
.with_consensus_genesis_praos_active_slot_coeff(ActiveSlotCoefficient::MAXIMUM)
.with_slot_duration(4)
.with_epoch_stability_depth(10)
.with_kes_update_speed(KesUpdateSpeed::new(43200).unwrap()),
)
.unwrap();
jormungandr.steal_temp_dir().unwrap().into_persistent();
let configuration = Configuration::duration(
1,
std::time::Duration::from_secs(60),
100,
Monitor::Standard(100),
100,
1_000,
);
let mut request_generator = TransactionGenerator::new(
FragmentSenderSetup::no_verify(),
jormungandr.to_remote(),
jormungandr.genesis_block_hash(),
jormungandr.fees(),
);
request_generator.fill_from_faucet(&mut faucet);
load::start_async(
request_generator,
FragmentStatusProvider::new(jormungandr.to_remote()),
configuration,
"Wallet backend load test",
);
}