Skip to content

Commit 4f446f2

Browse files
AlbertoDeckowclaude
andcommitted
Let the on-device chain test skip when there is no Portal
The QUIC cases built their node inside runCatching, so with no Portal the assumption failure that should have skipped them was caught as an ordinary throwable: one case failed asserting on it, which is what turned CI's device job red, and the other passed having tested nothing. The node is now built before runCatching. Reproduced and verified with CI's own command on API 31 and API 35 emulators with no Portal: 57 tests, none failing, 33 skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9ca1589 commit 4f446f2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎app/src/androidTest/kotlin/eu/nodepass/somewhere/quic/ChainVerificationOnDeviceTest.kt‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ import org.junit.runner.RunWith
3131
*/
3232
@RunWith(AndroidJUnit4::class)
3333
class ChainVerificationOnDeviceTest {
34+
// Built outside any runCatching: with no Portal, node() skips the test by
35+
// throwing an assumption failure, which runCatching would otherwise swallow.
3436
private fun byName(net: String) =
3537
E2eEnvironment.node(net = net).let { it.copy(certificateVerification = CertificateVerification.Sni(it.host)) }
3638

@@ -43,17 +45,18 @@ class ChainVerificationOnDeviceTest {
4345

4446
@Test
4547
fun aGeneratedCertificateIsRefusedOverQuic() {
46-
val failure =
47-
runCatching { E2eEnvironment.openQuic(byName("udp")).use { it.completeHandshake() } }.exceptionOrNull()
48+
val node = byName("udp")
49+
val failure = runCatching { E2eEnvironment.openQuic(node).use { it.completeHandshake() } }.exceptionOrNull()
4850
assertTrue("expected a QUIC failure, got $failure", failure is QuicException)
4951
val reason = (failure as QuicException).failure
5052
assertTrue("expected a trust refusal, got ${reason.detail}", reason is QuicFailure.Untrusted)
5153
}
5254

5355
@Test
5456
fun aRefusedConnectionIsNotLeftOpen() {
57+
val node = byName("udp")
5558
val before = QuicConnection.liveConnections()
56-
runCatching { E2eEnvironment.openQuic(byName("udp")).use { it.completeHandshake() } }
59+
runCatching { E2eEnvironment.openQuic(node).use { it.completeHandshake() } }
5760
assertEquals(before, QuicConnection.liveConnections())
5861
}
5962
}

0 commit comments

Comments
 (0)