From 9273ae0fd0e11ec70442e559b336331fa3aa6ddb Mon Sep 17 00:00:00 2001 From: Junyu Lai Date: Thu, 23 Nov 2023 11:29:35 +0800 Subject: [PATCH] Relax testValidation pass condition The issue arises when the network becomes validated based on the isCaptivePortal success with HTTPS, even though the HTTP probe hasn't been executed yet. Given that there is no way to ensure HTTP probe was sent in this case, the pass condition should be relaxed, allowing a single https query instead of expecting both. Test: atest FrameworksNetIntegrationTests:ConnectivityServiceIntegrationTest#testValidation \ --rerun-until-failure 100 (With hardcoded sleep when starting HTTP probe) Fix: 303351630 Change-Id: I580e9a3a868cd0b3395a20ace27b006529475312 --- .../integrationtests/ConnectivityServiceIntegrationTest.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt b/tests/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt index 9b082a447c..496d163208 100644 --- a/tests/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt +++ b/tests/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt @@ -255,7 +255,12 @@ class ConnectivityServiceIntegrationTest { na.connect() testCallback.expectAvailableThenValidatedCallbacks(na.network, TEST_TIMEOUT_MS) - assertEquals(2, nsInstrumentation.getRequestUrls().size) + val requestedSize = nsInstrumentation.getRequestUrls().size + if (requestedSize == 2 || (requestedSize == 1 && + nsInstrumentation.getRequestUrls()[0] == httpsProbeUrl)) { + return + } + fail("Unexpected request urls: ${nsInstrumentation.getRequestUrls()}") } @Test