File tree 1 file changed +24
-11
lines changed
test/test-manager/src/tests
1 file changed +24
-11
lines changed Original file line number Diff line number Diff line change @@ -262,19 +262,32 @@ pub async fn test_automatic_wireguard_rotation(
262
262
DaemonEvent :: Device ( device_event) => Some ( device_event) ,
263
263
_ => None ,
264
264
} ;
265
- let device_event = tokio :: task :: spawn ( tokio:: time:: timeout (
265
+ let device_event_listener = tokio:: time:: timeout (
266
266
Duration :: from_secs ( 100 ) ,
267
267
helpers:: find_daemon_event ( event_listener, device_event) ,
268
- ) )
269
- . await ?
270
- . context ( "Tunnel event listener timed out" ) ??;
271
-
272
- let new_key = device_event
273
- . new_state
274
- . into_device ( )
275
- . context ( "Could not get device" ) ?
276
- . device
277
- . pubkey ;
268
+ ) ;
269
+ let new_key = match device_event_listener. await {
270
+ Err ( err) => {
271
+ log:: warn!( "{err}" ) ;
272
+ log:: warn!(
273
+ "Did not observe any daemon event indicating that a key rotation happened"
274
+ ) ;
275
+ // Note: The key rotation could possible have happened without us noticing due to
276
+ // some raceiness in the timeframe between starting the daemon and us starting to
277
+ // listen for new daemon events. Thus, it is probably a good idea to check manually if the
278
+ // device key was rotated.
279
+ log:: info!( "Manually checking if device key was rotated" ) ;
280
+ mullvad_client
281
+ . get_device ( )
282
+ . await
283
+ . context ( "Failed to get device data" ) ?
284
+ }
285
+ Ok ( device_event) => device_event?. new_state ,
286
+ }
287
+ . logged_in ( )
288
+ . context ( "Client is not logged in to a valid account" ) ?
289
+ . device
290
+ . pubkey ;
278
291
279
292
assert_ne ! ( old_key, new_key) ;
280
293
}
You can’t perform that action at this time.
0 commit comments