From 8f31a73b84fd96a9b2c0fa2a220cdfe65f3728fa Mon Sep 17 00:00:00 2001 From: Yan Yan Date: Fri, 3 Jan 2025 16:21:15 -0800 Subject: [PATCH] Increase the timeout to deflake the VCN test This patch is to deflake testEnterSafeModeImmediately_safeModeEnabled. Previously this test required that within 0.5 seconds after setVcnConfig was called, VCN should send a VCN_STATUS_CODE_ACTIVE callback to the cts. However, sending this callback requires cts to gain carrier privileges and in some devices it takes longer than 0.5 seconds. This patch mitigates the test issue by extending the timeout. Bug: 386884143 Test: CtsVcnTestCases Flag: EXEMPT; test code Change-Id: Id5f7b70a0c7f68e58ab045be2126194f936ebb0f --- .../cts/src/android/net/vcn/cts/VcnManagerTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Vcn/tests/cts/src/android/net/vcn/cts/VcnManagerTest.java b/Vcn/tests/cts/src/android/net/vcn/cts/VcnManagerTest.java index 81630ffe6d..da6ae98d1d 100644 --- a/Vcn/tests/cts/src/android/net/vcn/cts/VcnManagerTest.java +++ b/Vcn/tests/cts/src/android/net/vcn/cts/VcnManagerTest.java @@ -110,7 +110,7 @@ import java.util.concurrent.TimeUnit; public class VcnManagerTest extends VcnTestBase { private static final String TAG = VcnManagerTest.class.getSimpleName(); - private static final int TIMEOUT_MS = 500; + private static final int CALLBACK_TIMEOUT_MS = 5000; private static final long SAFEMODE_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(35); private static final int ACTIVE_SUB_ID_TIMEOUT_SECONDS = 60; @@ -263,7 +263,7 @@ public class VcnManagerTest extends VcnTestBase { } public void awaitOnPolicyChanged() throws Exception { - mFutureOnPolicyChanged.get(TIMEOUT_MS, TimeUnit.MILLISECONDS); + mFutureOnPolicyChanged.get(CALLBACK_TIMEOUT_MS, TimeUnit.MILLISECONDS); } } @@ -523,14 +523,16 @@ public class VcnManagerTest extends VcnTestBase { } public int awaitOnStatusChanged() throws Exception { - final Integer status = mOnStatusChangedHistory.poll(TIMEOUT_MS, TimeUnit.MILLISECONDS); + final Integer status = + mOnStatusChangedHistory.poll(CALLBACK_TIMEOUT_MS, TimeUnit.MILLISECONDS); // Null means timeout return status == null ? VCN_STATUS_CODE_AWAIT_TIMEOUT : status; } public GatewayConnectionError awaitOnGatewayConnectionError() throws Exception { - return mOnGatewayConnectionErrorHistory.poll(TIMEOUT_MS, TimeUnit.MILLISECONDS); + return mOnGatewayConnectionErrorHistory.poll( + CALLBACK_TIMEOUT_MS, TimeUnit.MILLISECONDS); } }