Skip to content

Commit cab7cb1

Browse files
authored
Merge pull request #1679 from input-output-hk/dlachaume/1676/fix-aggregator-stress-test
Fix aggregator stress test
2 parents 24f749b + 4f3fc48 commit cab7cb1

File tree

4 files changed

+62
-25
lines changed

4 files changed

+62
-25
lines changed

.github/workflows/aggregator-stress-test.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,26 @@ jobs:
5252
workflow: ci.yml
5353
workflow_conclusion: success
5454

55+
- name: Download test runners
56+
uses: dawidd6/action-download-artifact@v3
57+
with:
58+
name: mithril-tooling-Linux-X64
59+
path: ./bin
60+
commit: ${{ inputs.commit_sha }}
61+
workflow: ci.yml
62+
workflow_conclusion: success
63+
5564
- name: Set permissions
5665
shell: bash
5766
working-directory: ./bin
58-
run: chmod +x ./mithril-aggregator
59-
60-
- name: Build the aggregator stress test
61-
working-directory: mithril-test-lab/mithril-end-to-end
62-
run: make build
67+
run: |
68+
chmod +x ./mithril-aggregator
69+
chmod +x ./load-aggregator
6370
6471
- name: Run the aggregator stress test
65-
working-directory: mithril-test-lab/mithril-end-to-end
6672
run: |
67-
./load-aggregator ${{ steps.prepare.outputs.debug_level }} \
68-
--cardano-cli-path script/mock-cardano-cli \
69-
--aggregator-dir ../../bin \
73+
./bin/load-aggregator ${{ steps.prepare.outputs.debug_level }} \
74+
--cardano-cli-path ./mithril-test-lab/mithril-end-to-end/script/mock-cardano-cli \
75+
--aggregator-dir ./bin \
7076
--num-signers=${{ inputs.num_signers }} \
7177
--num-clients=${{ inputs.num_clients }}

.github/workflows/ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
# We separate the build in 2 steps as we want to avoid side effects with Rust feature unification.
3333
- name: Cargo build - Tooling
3434
shell: bash
35-
run: cargo build --release -p mithril-end-to-end
35+
run: cargo build --release --bin mithril-end-to-end --bin load-aggregator
3636

3737
- name: Build Mithril workspace & publish artifacts
3838
uses: ./.github/workflows/actions/build-upload-mithril-artifact
@@ -58,8 +58,10 @@ jobs:
5858
- name: Publish End-to-end runner (${{ runner.os }}-${{ runner.arch }})
5959
uses: actions/upload-artifact@v4
6060
with:
61-
name: mithril-end-to-end-${{ runner.os }}-${{ runner.arch }}
62-
path: target/release/mithril-end-to-end
61+
name: mithril-tooling-${{ runner.os }}-${{ runner.arch }}
62+
path: |
63+
target/release/mithril-end-to-end
64+
target/release/load-aggregator
6365
if-no-files-found: error
6466

6567
- name: Prepare test lab eras
@@ -302,7 +304,7 @@ jobs:
302304
- name: Download rust test runner
303305
uses: actions/download-artifact@v4
304306
with:
305-
name: mithril-end-to-end-${{ runner.os }}-${{ runner.arch }}
307+
name: mithril-tooling-${{ runner.os }}-${{ runner.arch }}
306308
path: ./
307309

308310
- run: |

mithril-test-lab/mithril-end-to-end/src/stress_test/aggregator_helpers.rs

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ pub async fn bootstrap_aggregator(
5858
)
5959
.await?;
6060

61+
restart_aggregator_and_move_one_epoch_forward(&mut aggregator, current_epoch, args).await?;
62+
63+
fake_signer::try_register_signer_until_registration_round_is_open(
64+
&aggregator,
65+
&signers_fixture.signers()[0],
66+
*current_epoch + 1,
67+
Duration::from_secs(60),
68+
)
69+
.await?;
70+
6171
info!(">> Send the Signer Key Registrations payloads for the genesis signers");
6272
let errors = fake_signer::register_signers_to_aggregator(
6373
&aggregator,
@@ -66,21 +76,17 @@ pub async fn bootstrap_aggregator(
6676
)
6777
.await?;
6878
assert_eq!(0, errors);
69-
aggregator.stop().await.unwrap();
70-
71-
info!(">> Move one epoch forward in order to issue the genesis certificate");
72-
*current_epoch += 1;
73-
fake_chain::set_epoch(&args.mock_epoch_file_path(), *current_epoch);
7479

75-
info!(">> Restarting the aggregator still with a large run interval");
76-
aggregator.serve().unwrap();
77-
wait::for_http_response(
78-
&format!("{}/epoch-settings", aggregator.endpoint()),
79-
Duration::from_secs(10),
80-
"Waiting for the aggregator to start",
80+
fake_signer::try_register_signer_until_registration_round_is_open(
81+
&aggregator,
82+
&signers_fixture.signers()[0],
83+
*current_epoch + 1,
84+
Duration::from_secs(60),
8185
)
8286
.await?;
8387

88+
restart_aggregator_and_move_one_epoch_forward(&mut aggregator, current_epoch, args).await?;
89+
8490
info!(">> Send the Signer Key Registrations payloads for next genesis signers");
8591
let errors = fake_signer::register_signers_to_aggregator(
8692
&aggregator,
@@ -115,3 +121,26 @@ pub async fn bootstrap_aggregator(
115121

116122
Ok(aggregator)
117123
}
124+
125+
async fn restart_aggregator_and_move_one_epoch_forward(
126+
aggregator: &mut Aggregator,
127+
current_epoch: &mut Epoch,
128+
args: &AggregatorParameters,
129+
) -> StdResult<()> {
130+
info!(">> Stop the aggregator to move one epoch forward");
131+
aggregator.stop().await.unwrap();
132+
133+
*current_epoch += 1;
134+
fake_chain::set_epoch(&args.mock_epoch_file_path(), *current_epoch);
135+
136+
info!(">> Restarting the aggregator with a large run interval");
137+
aggregator.serve().unwrap();
138+
wait::for_http_response(
139+
&format!("{}/epoch-settings", aggregator.endpoint()),
140+
Duration::from_secs(10),
141+
"Waiting for the aggregator to start",
142+
)
143+
.await?;
144+
145+
Ok(())
146+
}

mithril-test-lab/mithril-end-to-end/src/stress_test/wait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ where
4848
}
4949
_ => request_first_list_item_with_expected_size::<I>(url, expected_size).await,
5050
},
51-
Err(err) => Err(anyhow!(err).context("Request to `{url}` failed")),
51+
Err(err) => Err(anyhow!(err).context(format!("Request to `{url}` failed"))),
5252
}
5353
}
5454

0 commit comments

Comments
 (0)