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
This commit is contained in:
Yan Yan 2025-01-03 16:21:15 -08:00
commit 8f31a73b84

View file

@ -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);
}
}