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 {
379
379
}
380
380
}
381
381
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
-
417
382
#[ cfg( test) ]
418
383
mod tests {
419
384
use http:: response:: Builder as HttpResponseBuilder ;
Original file line number Diff line number Diff line change
1
+ #[ cfg( test) ]
1
2
use std:: collections:: HashMap ;
2
3
3
4
use async_trait:: async_trait;
4
5
use mithril_common:: StdResult ;
6
+ #[ cfg( test) ]
5
7
use tokio:: sync:: RwLock ;
6
8
7
9
use mithril_common:: entities:: { Epoch , ProtocolParameters } ;
@@ -56,18 +58,20 @@ pub trait EpochSettingsStorer:
56
58
}
57
59
}
58
60
61
+ #[ cfg( test) ]
59
62
pub struct FakeEpochSettingsStorer {
60
63
pub epoch_settings : RwLock < HashMap < Epoch , AggregatorEpochSettings > > ,
61
64
}
62
65
66
+ #[ cfg( test) ]
63
67
impl FakeEpochSettingsStorer {
64
- #[ cfg( test) ]
65
68
pub fn new ( data : Vec < ( Epoch , AggregatorEpochSettings ) > ) -> Self {
66
69
let epoch_settings = RwLock :: new ( data. into_iter ( ) . collect ( ) ) ;
67
70
Self { epoch_settings }
68
71
}
69
72
}
70
73
74
+ #[ cfg( test) ]
71
75
#[ async_trait]
72
76
impl ProtocolParametersRetriever for FakeEpochSettingsStorer {
73
77
async fn get_protocol_parameters ( & self , epoch : Epoch ) -> StdResult < Option < ProtocolParameters > > {
@@ -78,6 +82,7 @@ impl ProtocolParametersRetriever for FakeEpochSettingsStorer {
78
82
}
79
83
}
80
84
85
+ #[ cfg( test) ]
81
86
#[ async_trait]
82
87
impl EpochSettingsStorer for FakeEpochSettingsStorer {
83
88
async fn save_epoch_settings (
@@ -97,6 +102,7 @@ impl EpochSettingsStorer for FakeEpochSettingsStorer {
97
102
}
98
103
}
99
104
105
+ #[ cfg( test) ]
100
106
#[ async_trait]
101
107
impl EpochPruningTask for FakeEpochSettingsStorer {
102
108
fn pruned_data ( & self ) -> & ' static str {
Original file line number Diff line number Diff line change @@ -24,18 +24,19 @@ pub trait TarAppender: Send {
24
24
}
25
25
}
26
26
27
+ #[ cfg( test) ]
27
28
pub struct AppenderDirAll {
28
29
target_directory : PathBuf ,
29
30
}
30
-
31
+ # [ cfg ( test ) ]
31
32
impl AppenderDirAll {
32
33
// Note: Not used anymore outside of tests but useful tool to keep around if we ever need to archive a directory
33
- #[ cfg( test) ]
34
34
pub fn new ( target_directory : PathBuf ) -> Self {
35
35
Self { target_directory }
36
36
}
37
37
}
38
38
39
+ #[ cfg( test) ]
39
40
impl TarAppender for AppenderDirAll {
40
41
fn append < T : Write > ( & self , tar : & mut tar:: Builder < T > ) -> StdResult < ( ) > {
41
42
tar. append_dir_all ( "." , & self . target_directory ) . with_context ( || {
You can’t perform that action at this time.
0 commit comments