From 32fef6574f3a8bcd33bd23099e47e469dee5114e Mon Sep 17 00:00:00 2001 From: Yan Yan Date: Mon, 24 Feb 2025 17:32:43 -0800 Subject: [PATCH] Skip some VCN unit tests on user builds Configuring restricted transport types is for experiments purposes and only allowed on a debuggable build. This patch ensures relevant unit tests are skipped on user builds. Since the experimental configurability is no longer needed anymore, there will be followup CLs to remove the feature and the tests. Bug: 397874808 Test: run mts-user -m FrameworksVcnTests on a BP2A.250218.001 user build Flag: EXEMPT; test code change Change-Id: I9ca23b2901d740d3ddc5ba4febba4a300e0812bb --- .../server/VcnManagementServiceTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Vcn/tests/unit/java/com/android/server/VcnManagementServiceTest.java b/Vcn/tests/unit/java/com/android/server/VcnManagementServiceTest.java index a97f9a837b..3cccbc4194 100644 --- a/Vcn/tests/unit/java/com/android/server/VcnManagementServiceTest.java +++ b/Vcn/tests/unit/java/com/android/server/VcnManagementServiceTest.java @@ -41,6 +41,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; @@ -1088,6 +1089,10 @@ public class VcnManagementServiceTest { @Test public void testGetRestrictedTransportsFromCarrierConfig() { + assumeTrue( + "Configuring restricted transport types is only allowed on a debuggable build", + Build.isDebuggable()); + final Set restrictedTransports = new ArraySet<>(); restrictedTransports.add(TRANSPORT_CELLULAR); restrictedTransports.add(TRANSPORT_WIFI); @@ -1109,6 +1114,10 @@ public class VcnManagementServiceTest { @Test public void testGetRestrictedTransportsFromCarrierConfig_noRestrictPolicyConfigured() { + assumeTrue( + "Configuring restricted transport types is only allowed on a debuggable build", + Build.isDebuggable()); + final Set restrictedTransports = Collections.singleton(TRANSPORT_WIFI); final PersistableBundleWrapper carrierConfig = @@ -1123,6 +1132,10 @@ public class VcnManagementServiceTest { @Test public void testGetRestrictedTransportsFromCarrierConfig_noCarrierConfig() { + assumeTrue( + "Configuring restricted transport types is only allowed on a debuggable build", + Build.isDebuggable()); + final Set restrictedTransports = Collections.singleton(TRANSPORT_WIFI); final TelephonySubscriptionSnapshot lastSnapshot = @@ -1134,6 +1147,10 @@ public class VcnManagementServiceTest { @Test public void testGetRestrictedTransportsFromCarrierConfigAndVcnConfig() { + assumeTrue( + "Configuring restricted transport types is only allowed on a debuggable build", + Build.isDebuggable()); + // Configure restricted transport in CarrierConfig final Set restrictedTransportInCarrierConfig = Collections.singleton(TRANSPORT_WIFI);