Skip to content

Commit c4df02d

Browse files
committed
Replace unwrap by a with_context on thread creating artifact
1 parent a73fcde commit c4df02d

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

mithril-aggregator/src/services/signed_entity.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,12 @@ impl SignedEntityService for MithrilSignedEntityService {
245245
.await;
246246
service
247247
.signed_entity_type_lock
248-
.release(signed_entity_type)
248+
.release(signed_entity_type.clone())
249249
.await;
250250

251-
result.unwrap()
251+
result.with_context(|| format!(
252+
"Signed Entity Service can not store signed entity with type: '{signed_entity_type}'"
253+
))?
252254
}))
253255
}
254256

@@ -428,7 +430,6 @@ mod tests {
428430
atomic_stop: Arc<AtomicBool>,
429431
snapshot: Snapshot,
430432
}
431-
impl LongArtifactBuilder {}
432433

433434
let snapshot = fake_data::snapshots(1).first().unwrap().to_owned();
434435

@@ -754,7 +755,12 @@ mod tests {
754755
.await
755756
.unwrap();
756757

757-
join_handle.await.unwrap().unwrap_err();
758+
let error = join_handle.await.unwrap().unwrap_err();
759+
assert!(
760+
error.to_string().contains("CardanoImmutableFilesFull"),
761+
"Error should contains CardanoImmutableFilesFull but was: {}",
762+
error
763+
);
758764

759765
assert!(
760766
!signed_entity_type_service
@@ -778,7 +784,12 @@ mod tests {
778784
.await
779785
.unwrap();
780786

781-
join_handle.await.unwrap_err();
787+
let error = join_handle.await.unwrap().unwrap_err();
788+
assert!(
789+
error.to_string().contains("CardanoImmutableFilesFull"),
790+
"Error should contains CardanoImmutableFilesFull but was: {}",
791+
error
792+
);
782793

783794
assert!(
784795
!signed_entity_type_service

mithril-aggregator/tests/test_extensions/runtime_tester.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ use mithril_aggregator::{
99
AggregatorRuntime, Configuration, DependencyContainer, DumbSnapshotUploader, DumbSnapshotter,
1010
SignerRegistrationError,
1111
};
12-
use mithril_common::entities::SignedEntityType;
1312
use mithril_common::{
1413
cardano_block_scanner::{DumbBlockScanner, ScannedBlock},
1514
chain_observer::{ChainObserver, FakeObserver},
1615
crypto_helper::ProtocolGenesisSigner,
1716
digesters::{DumbImmutableDigester, DumbImmutableFileObserver, ImmutableFileObserver},
1817
entities::{
1918
BlockNumber, Certificate, CertificateSignature, ChainPoint, Epoch, ImmutableFileNumber,
20-
SignedEntityTypeDiscriminants, Snapshot, StakeDistribution, TimePoint,
19+
SignedEntityType, SignedEntityTypeDiscriminants, Snapshot, StakeDistribution, TimePoint,
2120
},
2221
era::{adapters::EraReaderDummyAdapter, EraMarker, EraReader, SupportedEra},
2322
test_utils::{

0 commit comments

Comments
 (0)