From be2657a4dfddbece4ffbced2916eede4b9d0ea7f Mon Sep 17 00:00:00 2001 From: DJO <790521+Alenar@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:23:28 +0200 Subject: [PATCH] fix: signer raised error when `register_signature` returned `202` --- .../src/services/aggregator_client.rs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/mithril-signer/src/services/aggregator_client.rs b/mithril-signer/src/services/aggregator_client.rs index 21f12476595..a07319e8683 100644 --- a/mithril-signer/src/services/aggregator_client.rs +++ b/mithril-signer/src/services/aggregator_client.rs @@ -336,7 +336,7 @@ impl AggregatorClient for AggregatorHTTPClient { match response { Ok(response) => match response.status() { - StatusCode::CREATED => Ok(()), + StatusCode::CREATED | StatusCode::ACCEPTED => Ok(()), StatusCode::GONE => { debug!(self.logger, "Aggregator already certified that message"; "signed_entity_type" => ?signed_entity_type); Ok(()) @@ -896,6 +896,31 @@ mod tests { register_signatures.expect("unexpected error"); } + #[tokio::test] + async fn test_register_signatures_ok_202() { + let single_signatures = fake_data::single_signatures((1..5).collect()); + let (server, config, api_version_provider) = setup_test(); + let _server_mock = server.mock(|when, then| { + when.method(POST).path("/register-signatures"); + then.status(202); + }); + let certificate_handler = AggregatorHTTPClient::new( + config.aggregator_endpoint, + config.relay_endpoint, + Arc::new(api_version_provider), + None, + TestLogger::stdout(), + ); + let register_signatures = certificate_handler + .register_signatures( + &SignedEntityType::dummy(), + &single_signatures, + &ProtocolMessage::default(), + ) + .await; + register_signatures.expect("unexpected error"); + } + #[tokio::test] async fn test_register_signatures_ko_412() { let (server, config, api_version_provider) = setup_test();