@@ -147,61 +147,3 @@ impl DriaComputeNode {
147
147
}
148
148
}
149
149
}
150
-
151
- #[ cfg( test) ]
152
- mod tests {
153
- use super :: * ;
154
- use crate :: DriaComputeNodeConfig ;
155
- use tokio:: time:: sleep;
156
- use tokio_util:: sync:: CancellationToken ;
157
-
158
- // FIXME: test is failing
159
- #[ tokio:: test]
160
- #[ ignore = "run this manually" ]
161
- async fn test_publish_message ( ) -> eyre:: Result < ( ) > {
162
- let _ = env_logger:: builder ( )
163
- . filter_level ( log:: LevelFilter :: Off )
164
- . filter_module ( "dkn_compute" , log:: LevelFilter :: Debug )
165
- . filter_module ( "dkn_p2p" , log:: LevelFilter :: Debug )
166
- . is_test ( true )
167
- . try_init ( ) ;
168
-
169
- // create node
170
- let cancellation = CancellationToken :: new ( ) ;
171
- let config = DriaComputeNodeConfig :: default ( ) ;
172
- let ( mut node, p2p, _, _) = DriaComputeNode :: new ( config) . await ?;
173
-
174
- // spawn p2p task
175
- let p2p_task = tokio:: spawn ( async move { p2p. run ( ) . await } ) ;
176
-
177
- // launch & wait for a while for connections
178
- let run_cancellation = cancellation. clone ( ) ;
179
- let wait_duration = tokio:: time:: Duration :: from_secs ( 20 ) ;
180
- log:: info!(
181
- "Waiting a bit ({}ms) for peer setup." ,
182
- wait_duration. as_millis( )
183
- ) ;
184
- sleep ( wait_duration) . await ;
185
- tokio:: select! {
186
- _ = node. run( run_cancellation) => ( ) ,
187
- _ = tokio:: time:: sleep( wait_duration) => cancellation. cancel( ) ,
188
- }
189
- log:: info!( "Connected Peers:\n {:#?}" , node. peers( ) . await ?) ;
190
-
191
- // publish a dummy message
192
- let topic = "foo" ;
193
- let message = node. new_message ( "hello from the other side" , topic) ;
194
- node. subscribe ( topic) . await ?;
195
- node. publish ( message) . await ?;
196
- node. unsubscribe ( topic) . await ?;
197
-
198
- // close everything
199
- log:: info!( "Shutting down node." ) ;
200
- node. p2p . shutdown ( ) . await ?;
201
-
202
- // wait for task handle
203
- p2p_task. await ?;
204
-
205
- Ok ( ( ) )
206
- }
207
- }
0 commit comments