diff options
| author | Emīls <emils@mullvad.net> | 2022-02-15 13:10:29 +0000 |
|---|---|---|
| committer | Emīls <emils@mullvad.net> | 2022-02-15 15:21:34 +0000 |
| commit | 039efebabccb1050c3faf54d095db62c07481267 (patch) | |
| tree | 4b5e0e7c5dc684eb79c118f85498e907fda2a965 | |
| parent | e0107f9b07bd4d06c59966cb0f30697a7fc71641 (diff) | |
| download | mullvadvpn-039efebabccb1050c3faf54d095db62c07481267.tar.xz mullvadvpn-039efebabccb1050c3faf54d095db62c07481267.zip | |
Add extra slack to test_establish_timeout
`test_establish_timeout` has a great history of failing in CI for no
good reason. Whilst the _correct_ way of solving this issue would be to
mock the clock, I've added extra slack to the test to make it fail less
often.
| -rw-r--r-- | talpid-core/src/tunnel/wireguard/connectivity_check.rs | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/talpid-core/src/tunnel/wireguard/connectivity_check.rs b/talpid-core/src/tunnel/wireguard/connectivity_check.rs index 553943b576..162fb248a3 100644 --- a/talpid-core/src/tunnel/wireguard/connectivity_check.rs +++ b/talpid-core/src/tunnel/wireguard/connectivity_check.rs @@ -801,22 +801,13 @@ mod test { .unwrap(); } }); - let err = DELAY_ON_INITIAL_SETUP + Duration::from_millis(100); - assert!(!result_rx - .recv_timeout(Duration::from_millis(500) + err) - .unwrap() - .unwrap()); - assert!(!result_rx - .recv_timeout(Duration::from_secs(1) + err) - .unwrap() - .unwrap()); - assert!(!result_rx - .recv_timeout(Duration::from_secs(2) + err) - .unwrap() - .unwrap()); - assert!(!result_rx - .recv_timeout(Duration::from_secs(2) + err) - .unwrap() - .unwrap()); + let err = DELAY_ON_INITIAL_SETUP + Duration::from_millis(350); + let assert_rx = |recv_timeout: Duration| { + assert!(!result_rx.recv_timeout(recv_timeout + err).unwrap().unwrap()); + }; + assert_rx(Duration::from_millis(500)); + assert_rx(Duration::from_secs(1)); + assert_rx(Duration::from_secs(2)); + assert_rx(Duration::from_secs(2)); } } |
