@@ -18,12 +18,12 @@ use std::sync::Arc;
1818use url:: Url ;
1919
2020#[ cfg( test) ]
21- pub async fn create_test_app_state ( ) -> Data < AppState > {
21+ pub ( crate ) async fn create_test_app_state ( ) -> Data < AppState > {
2222 use shared:: utils:: MockStorageProvider ;
2323
2424 use crate :: {
25- metrics:: MetricsContext , p2p :: client :: P2PClient , scheduler :: Scheduler ,
26- utils :: loop_heartbeats :: LoopHeartbeats , ServerMode ,
25+ metrics:: MetricsContext , scheduler :: Scheduler , utils :: loop_heartbeats :: LoopHeartbeats ,
26+ ServerMode ,
2727 } ;
2828
2929 let store = Arc :: new ( RedisStore :: new_test ( ) ) ;
@@ -46,12 +46,8 @@ pub async fn create_test_app_state() -> Data<AppState> {
4646 let mock_storage = MockStorageProvider :: new ( ) ;
4747 let storage_provider = Arc :: new ( mock_storage) ;
4848 let metrics = Arc :: new ( MetricsContext :: new ( 1 . to_string ( ) ) ) ;
49- let wallet = Wallet :: new (
50- "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97" ,
51- Url :: parse ( "http://localhost:8545" ) . unwrap ( ) ,
52- )
53- . unwrap ( ) ;
54- let p2p_client = Arc :: new ( P2PClient :: new ( wallet. clone ( ) ) . await . unwrap ( ) ) ;
49+ let ( get_task_logs_tx, _) = tokio:: sync:: mpsc:: channel ( 1 ) ;
50+ let ( restart_task_tx, _) = tokio:: sync:: mpsc:: channel ( 1 ) ;
5551
5652 Data :: new ( AppState {
5753 store_context : store_context. clone ( ) ,
@@ -64,17 +60,17 @@ pub async fn create_test_app_state() -> Data<AppState> {
6460 scheduler,
6561 node_groups_plugin : None ,
6662 metrics,
67- p2p_client : p2p_client. clone ( ) ,
63+ get_task_logs_tx,
64+ restart_task_tx,
6865 } )
6966}
7067
7168#[ cfg( test) ]
72- pub async fn create_test_app_state_with_nodegroups ( ) -> Data < AppState > {
69+ pub ( crate ) async fn create_test_app_state_with_nodegroups ( ) -> Data < AppState > {
7370 use shared:: utils:: MockStorageProvider ;
7471
7572 use crate :: {
7673 metrics:: MetricsContext ,
77- p2p:: client:: P2PClient ,
7874 plugins:: node_groups:: { NodeGroupConfiguration , NodeGroupsPlugin } ,
7975 scheduler:: Scheduler ,
8076 utils:: loop_heartbeats:: LoopHeartbeats ,
@@ -116,12 +112,8 @@ pub async fn create_test_app_state_with_nodegroups() -> Data<AppState> {
116112 let mock_storage = MockStorageProvider :: new ( ) ;
117113 let storage_provider = Arc :: new ( mock_storage) ;
118114 let metrics = Arc :: new ( MetricsContext :: new ( 1 . to_string ( ) ) ) ;
119- let wallet = Wallet :: new (
120- "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97" ,
121- Url :: parse ( "http://localhost:8545" ) . unwrap ( ) ,
122- )
123- . unwrap ( ) ;
124- let p2p_client = Arc :: new ( P2PClient :: new ( wallet. clone ( ) ) . await . unwrap ( ) ) ;
115+ let ( get_task_logs_tx, _) = tokio:: sync:: mpsc:: channel ( 1 ) ;
116+ let ( restart_task_tx, _) = tokio:: sync:: mpsc:: channel ( 1 ) ;
125117
126118 Data :: new ( AppState {
127119 store_context : store_context. clone ( ) ,
@@ -134,12 +126,13 @@ pub async fn create_test_app_state_with_nodegroups() -> Data<AppState> {
134126 scheduler,
135127 node_groups_plugin,
136128 metrics,
137- p2p_client : p2p_client. clone ( ) ,
129+ get_task_logs_tx,
130+ restart_task_tx,
138131 } )
139132}
140133
141134#[ cfg( test) ]
142- pub fn setup_contract ( ) -> Contracts < WalletProvider > {
135+ pub ( crate ) fn setup_contract ( ) -> Contracts < WalletProvider > {
143136 let coordinator_key = "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97" ;
144137 let rpc_url: Url = Url :: parse ( "http://localhost:8545" ) . unwrap ( ) ;
145138 let wallet = Wallet :: new ( coordinator_key, rpc_url) . unwrap ( ) ;
@@ -154,12 +147,12 @@ pub fn setup_contract() -> Contracts<WalletProvider> {
154147}
155148
156149#[ cfg( test) ]
157- pub async fn create_test_app_state_with_metrics ( ) -> Data < AppState > {
150+ pub ( crate ) async fn create_test_app_state_with_metrics ( ) -> Data < AppState > {
158151 use shared:: utils:: MockStorageProvider ;
159152
160153 use crate :: {
161- metrics:: MetricsContext , p2p :: client :: P2PClient , scheduler :: Scheduler ,
162- utils :: loop_heartbeats :: LoopHeartbeats , ServerMode ,
154+ metrics:: MetricsContext , scheduler :: Scheduler , utils :: loop_heartbeats :: LoopHeartbeats ,
155+ ServerMode ,
163156 } ;
164157
165158 let store = Arc :: new ( RedisStore :: new_test ( ) ) ;
@@ -182,12 +175,8 @@ pub async fn create_test_app_state_with_metrics() -> Data<AppState> {
182175 let mock_storage = MockStorageProvider :: new ( ) ;
183176 let storage_provider = Arc :: new ( mock_storage) ;
184177 let metrics = Arc :: new ( MetricsContext :: new ( "0" . to_string ( ) ) ) ;
185- let wallet = Wallet :: new (
186- "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97" ,
187- Url :: parse ( "http://localhost:8545" ) . unwrap ( ) ,
188- )
189- . unwrap ( ) ;
190- let p2p_client = Arc :: new ( P2PClient :: new ( wallet. clone ( ) ) . await . unwrap ( ) ) ;
178+ let ( get_task_logs_tx, _) = tokio:: sync:: mpsc:: channel ( 1 ) ;
179+ let ( restart_task_tx, _) = tokio:: sync:: mpsc:: channel ( 1 ) ;
191180
192181 Data :: new ( AppState {
193182 store_context : store_context. clone ( ) ,
@@ -200,6 +189,7 @@ pub async fn create_test_app_state_with_metrics() -> Data<AppState> {
200189 scheduler,
201190 node_groups_plugin : None ,
202191 metrics,
203- p2p_client : p2p_client. clone ( ) ,
192+ get_task_logs_tx,
193+ restart_task_tx,
204194 } )
205195}
0 commit comments