summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2026-02-10 15:36:27 +0100
committerEmīls <emils@mullvad.net>2026-02-10 15:41:35 +0100
commitfe0bb02bdb3958d38864cb50c3d943ec497721af (patch)
treee9bbbb97c5fecd9b918317d88926f0c16d8737c4
parentf6a980ef3e8dedec38bfc9dce85b1afce509be80 (diff)
downloadmullvadvpn-ios-allow-multiple-fulfillments.tar.xz
mullvadvpn-ios-allow-multiple-fulfillments.zip
Fix testReconnectingTunnelRefreshesItsStatusios-allow-multiple-fulfillments
Since the simulated tunnel connection ends up always transitioning back to the connected state, this test will fail due to fulfilling the connected state expectation multiple times. The fix here is to not let that happen in the first place by removing the listener as soon as we see the expected state.
-rw-r--r--ios/MullvadVPNTests/MullvadVPN/TunnelManager/TunnelManagerTests.swift6
1 files changed, 4 insertions, 2 deletions
diff --git a/ios/MullvadVPNTests/MullvadVPN/TunnelManager/TunnelManagerTests.swift b/ios/MullvadVPNTests/MullvadVPN/TunnelManager/TunnelManagerTests.swift
index 557e40bbf2..30ca6a2576 100644
--- a/ios/MullvadVPNTests/MullvadVPN/TunnelManager/TunnelManagerTests.swift
+++ b/ios/MullvadVPNTests/MullvadVPN/TunnelManager/TunnelManagerTests.swift
@@ -222,10 +222,12 @@ class TunnelManagerTests: XCTestCase {
let connectedExpectation = expectation(description: "Connected")
let reconnectingExpectation = expectation(description: "Reconnecting")
let tunnelObserver = TunnelBlockObserver(
- didUpdateTunnelStatus: { _, tunnelStatus in
+ didUpdateTunnelStatus: { manager, tunnelStatus in
switch tunnelStatus.state {
case .connected: connectedExpectation.fulfill()
- case .reconnecting: reconnectingExpectation.fulfill()
+ case .reconnecting:
+ manager.removeObserver(self.tunnelObserver)
+ reconnectingExpectation.fulfill()
default: return
}
}