File tree Expand file tree Collapse file tree 3 files changed +10
-38
lines changed Expand file tree Collapse file tree 3 files changed +10
-38
lines changed Original file line number Diff line number Diff line change @@ -379,41 +379,6 @@ impl RemoteCertificateRetriever for AggregatorHTTPClient {
379379 }
380380}
381381
382- #[ cfg( test) ]
383- pub ( crate ) mod dumb {
384- use tokio:: sync:: RwLock ;
385-
386- use mithril_common:: test:: double:: Dummy ;
387-
388- use super :: * ;
389-
390- /// This aggregator client is intended to be used by test services.
391- /// It actually does not communicate with an aggregator host but mimics this behavior.
392- /// It is driven by a Tester that controls the data it can return, and it can return its internal state for testing.
393- pub struct DumbAggregatorClient {
394- epoch_settings : RwLock < Option < LeaderAggregatorEpochSettings > > ,
395- }
396-
397- impl Default for DumbAggregatorClient {
398- fn default ( ) -> Self {
399- Self {
400- epoch_settings : RwLock :: new ( Some ( LeaderAggregatorEpochSettings :: dummy ( ) ) ) ,
401- }
402- }
403- }
404-
405- #[ async_trait]
406- impl LeaderAggregatorClient for DumbAggregatorClient {
407- async fn retrieve_epoch_settings (
408- & self ,
409- ) -> StdResult < Option < LeaderAggregatorEpochSettings > > {
410- let epoch_settings = self . epoch_settings . read ( ) . await . clone ( ) ;
411-
412- Ok ( epoch_settings)
413- }
414- }
415- }
416-
417382#[ cfg( test) ]
418383mod tests {
419384 use http:: response:: Builder as HttpResponseBuilder ;
Original file line number Diff line number Diff line change 1+ #[ cfg( test) ]
12use std:: collections:: HashMap ;
23
34use async_trait:: async_trait;
45use mithril_common:: StdResult ;
6+ #[ cfg( test) ]
57use tokio:: sync:: RwLock ;
68
79use mithril_common:: entities:: { Epoch , ProtocolParameters } ;
@@ -56,18 +58,20 @@ pub trait EpochSettingsStorer:
5658 }
5759}
5860
61+ #[ cfg( test) ]
5962pub struct FakeEpochSettingsStorer {
6063 pub epoch_settings : RwLock < HashMap < Epoch , AggregatorEpochSettings > > ,
6164}
6265
66+ #[ cfg( test) ]
6367impl FakeEpochSettingsStorer {
64- #[ cfg( test) ]
6568 pub fn new ( data : Vec < ( Epoch , AggregatorEpochSettings ) > ) -> Self {
6669 let epoch_settings = RwLock :: new ( data. into_iter ( ) . collect ( ) ) ;
6770 Self { epoch_settings }
6871 }
6972}
7073
74+ #[ cfg( test) ]
7175#[ async_trait]
7276impl ProtocolParametersRetriever for FakeEpochSettingsStorer {
7377 async fn get_protocol_parameters ( & self , epoch : Epoch ) -> StdResult < Option < ProtocolParameters > > {
@@ -78,6 +82,7 @@ impl ProtocolParametersRetriever for FakeEpochSettingsStorer {
7882 }
7983}
8084
85+ #[ cfg( test) ]
8186#[ async_trait]
8287impl EpochSettingsStorer for FakeEpochSettingsStorer {
8388 async fn save_epoch_settings (
@@ -97,6 +102,7 @@ impl EpochSettingsStorer for FakeEpochSettingsStorer {
97102 }
98103}
99104
105+ #[ cfg( test) ]
100106#[ async_trait]
101107impl EpochPruningTask for FakeEpochSettingsStorer {
102108 fn pruned_data ( & self ) -> & ' static str {
Original file line number Diff line number Diff line change @@ -24,18 +24,19 @@ pub trait TarAppender: Send {
2424 }
2525}
2626
27+ #[ cfg( test) ]
2728pub struct AppenderDirAll {
2829 target_directory : PathBuf ,
2930}
30-
31+ # [ cfg ( test ) ]
3132impl AppenderDirAll {
3233 // Note: Not used anymore outside of tests but useful tool to keep around if we ever need to archive a directory
33- #[ cfg( test) ]
3434 pub fn new ( target_directory : PathBuf ) -> Self {
3535 Self { target_directory }
3636 }
3737}
3838
39+ #[ cfg( test) ]
3940impl TarAppender for AppenderDirAll {
4041 fn append < T : Write > ( & self , tar : & mut tar:: Builder < T > ) -> StdResult < ( ) > {
4142 tar. append_dir_all ( "." , & self . target_directory ) . with_context ( || {
You can’t perform that action at this time.
0 commit comments