Commit graph android_packages_modules_Co.../tests/cts/hostside
Message SHA1
Merge "Deflaking network access checks in CtsHostsideNetworkTests" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-04-06 05:48:36 +00:00
1d73c6bea5
Deflaking network access checks in CtsHostsideNetworkTests
Checking that the network was successfully restricted before starting
the activities in ConnOnActivityStartTest. This avoids races between uid
state changes and device state changes in NPMS code that lead to
unpredictable UnknownHostException flakes in the first iteration.

Moving the java cache clearing to happen immediately before the check,
so no side effect from different code can impact the DNS query.

Increasing the socket-timeout to mitigate socket timeout failures.

Changing the default test URL to generate a 204 to avoid any extraneous
errors that may arise in doing other I/O, and switching to the canonical
connectivity check URL on the android.com domain.

Enabling support for passing down a custom url to use for testing
network connectivity using the runner options. This will enable easily
switching between different URLs for debugging when required.

Using a dedicated data class to encapsulate information to be returned
from test app to the instrumentation app.
This makes the logic more resilient, readable and maintainable.

Test: atest CtsHostsideNetworkTests:HostsideConnOnActivityStartTest --\
--test-arg com.android.compatibility.common.tradefed.testtype.JarHostTest:\
set-option:com.android.cts.net.HostsideConnOnActivityStartTest:\
custom-url:"https\://www.example.com"

Bug: 330406935
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:04c638ee3a5bab7895817ebfc0d3f6a69b1ee26d)
Merged-In: I139408fc0a9ffa21d7bd2f3f249d45a7b25243b4
Change-Id: I139408fc0a9ffa21d7bd2f3f249d45a7b25243b4

Suprabh Shukla   authored and   Android Build Cherrypicker Worker   commited 2024-04-02 05:51:41 +00:00
a8ad3d5ef0
Replace connectToCell -> NetworkCallbackRule
Developers often forget to unregister requests in tests, and cleanup
code also makes tests more verbose.

Add a rule that unregisters callbacks automatically when after each test
method.

Replace current usage of connectToCell with this rule, as well as
network callback usage in CaptivePortalTest (which is one example that
did not unregister its callback).

Test: atest
Change-Id: Ie3b9c5cf529004b7b3af04bc13a7e69acfbbaa18

Remi NGUYEN VAN   commited 2024-04-02 11:18:20 +09:00
e629bb7c84
Add test for dropping packets to VPN address from non VPN-interface
Bug: 295800201
Test: HostsideVpnTests
Change-Id: I0785ee1562fa50c1b6a4aca9ac077ad753cc2700

Motomu Utsumi   commited 2024-03-15 15:23:55 +09:00
ffa2bce381
Merge "Revert^4 "Re-enable the tests for background restrictions"" into main
Suprabh Shukla   authored and   Gerrit Code Review   commited 2024-03-14 21:48:58 +00:00
ddeec3a7ad
Merge "Specify the desired callback type to deflake the tests" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2024-03-13 02:40:49 +00:00
4d9f787ead
Specify the desired callback type to deflake the tests
The test expects the absence of default network changes. However,
fluctuations in network capability during the test can introduce
flakiness. To enhance test stability, specify a callback for
deflaking.

Test: atest CtsHostsideNetworkTests
Bug: 329188322
Change-Id: I9ea2d5a03981f3a6584964d5a5a11e80f293edd2

Chiachang Wang   commited 2024-03-12 09:35:18 +00:00
fee93b0528
Revert^4 "Re-enable the tests for background restrictions"
7ff923029e
Reason for revert: b/327713895 was a false alarm.

Change-Id: Ia6742630eece19eeb8bdfa25f861726c7237ab6d

Suprabh Shukla   commited 2024-03-09 05:32:56 +00:00
b11b071422
Revert^3 "Re-enable the tests for background restrictions"
344e4c9bf9

Bug: 327713895
Change-Id: Ieb3cf27943f139a35b1bf89f57adbf31bd00f285

Suprabh Shukla   commited 2024-03-08 02:49:23 +00:00
7ff923029e
Revert^2 "Re-enable the tests for background restrictions"
36a8ecbb05

Bug: 304347838
Change-Id: I6f8b20e65539a7523db6a7a9d92444dec0523d10

Suprabh Shukla   commited 2024-02-27 22:39:27 +00:00
344e4c9bf9
Revert "Re-enable the tests for background restrictions"
Revert submission 2970571-turn-on-network-restrictions

Reason for revert: b/326370901

Reverted changes: /q/submissionid:2970571-turn-on-network-restrictions

Change-Id: I6d38da59ac979af3a600ba695de2890e2d4c7bb0

Suprabh Shukla   authored and   Gerrit Code Review   commited 2024-02-23 21:48:20 +00:00
36a8ecbb05
Re-enable the tests for background restrictions
The feature is now turned on so the tests can be re-enabled.
This reverts commit 6266342327.

Test: atest CtsHostsideNetworkTests

Bug: 304347838
Change-Id: I85f462e75931240bde8b0dd956c0011ec8435b8f

Suprabh Shukla   commited 2024-02-20 14:12:41 -08:00
375f6bba81
Temporarily skip the tests for background restrictions
Test: atest CtsHostsideNetworkTests

Bug: 304347838
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4cef70d592e91c2ccd3419f52bf779e29fcb4a79)
Merged-In: I88ffa390a890a09d95109518329ba6abcb162bc1
Change-Id: I88ffa390a890a09d95109518329ba6abcb162bc1

Suprabh Shukla   authored and   Android Build Cherrypicker Worker   commited 2024-02-15 22:30:39 +00:00
6266342327
CTS for default background network restrictions
Apps will now lose network access once they are in top-sleeping or
higher process state. Adding some cts tests to ensure correct behavior.

The tests are using temporarily using junit Assume to skip if the
feature flag is enabled to enable a following code migration.

Test: atest CtsHostsideNetworkTests

BYPASS_INCLUSIVE_LANGUAGE_REASON=Existing method

Bug: 304347838
Change-Id: Iba7c7bd01309fa7a301fdc1524033f0fad5ae512

Suprabh Shukla   commited 2024-02-13 17:08:10 -08:00
b2e574d4b8
[DON'T BLOCK] Test ownership migration rules
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.

For more details please refer to the link below,
<add g3 doc link>

Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5

Aditya Choudhary   commited 2024-01-31 12:34:50 +00:00
01b5ede2b2
Merge "Refactoring hostside network restrictions tests" into main
Suprabh Shukla   authored and   Gerrit Code Review   commited 2024-01-19 21:50:20 +00:00
52113d6a9f
Refactoring hostside network restrictions tests
The definition of background can be fluid and ambiguous. Refactored all
code to be explicit about process states when making assertions.

No functional change is expected to tests.

Test: atest CtsHostsideNetworkTests

Bug: 304347838

Change-Id: Ibc614d74f46d436cad4586c1d309bbb3648b8eb1
Merged-In: Ibc614d74f46d436cad4586c1d309bbb3648b8eb1

Suprabh Shukla   commited 2024-01-19 01:01:24 +00:00
52732642fa
ProcNetTest.java - reverse arguments to assertEquals()
currently we have:
  org.junit.ComparisonFailure: expected:<[]bic> but was:<[cu]bic>
	at org.junit.Assert.assertEquals(Assert.java:117)
but this is the reverse of the intended error:
  org.junit.ComparisonFailure: expected:<[cu]bic> but was:<bic>
	at org.junit.Assert.assertEquals(Assert.java:117)

method signature:
  public static void assertEquals(Object expected, Object actual)

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I322ea162f2818aaa1beba5c1b9febcf97d29eea1

Maciej Å»enczykowski   commited 2024-01-18 23:43:00 +00:00
d67fd53edf
[Test] Add mtcs tag to CtsHostsideNetworkTests
The test relies on the tethering module code. Test is supposed to run on the matching version of module prebuilt. Add mtcs tag to ensure this.

Bug: 316939964
Change-Id: I2b4d212a7dadf11e847abc5b6855442fdcc87a7c

Ken Chen   commited 2023-12-25 05:09:50 +00:00
c2cbf84a8a
Force the test app into a non-idle state.
Otherwise, the app idle state could interfere
with the test verifications.

Bug: 317204099
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideNetworkCallbackTests.java
Change-Id: I057546082ffc2f6f5c8da8928824a5261d0f8c7f

Sudheer Shanka   commited 2023-12-20 20:13:46 +00:00
9d8ab0cafd
Disable LowPowerStandby by adding configuration
On low-performance devices, this test case will activate LOW_POWER_STANDBY mode during the test, which should not be initiated in this test case.

The LOW_POWER_STANDBY mode blocks APK from accessing the network, resulting in test failures.

BUG:301027368
Signed-off-by: Wenbin.Chen <wenbin.chen@amlogic.com>
Change-Id: I1085addd22f4f3b709e1875049633832c5dac852
Test: CtsHostsideNetworkTests#com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Wenbin.Chen   authored and   chen wenbin   commited 2023-11-15 02:48:09 +00:00
df1bf2a963
Merge "[Test] CTS for DNS query fail-fast feature" into main
Ken Chen   authored and   Gerrit Code Review   commited 2023-11-13 03:23:40 +00:00
a4e35a49b7
[Test] CTS for DNS query fail-fast feature
For Power Saver tests, verify not only the network connectivity of
restricted apps, but also error cause.

Bug: 288340533
Test: atest
CtsHostsideNetworkTests: com.android.cts.net.HostsideNetworkCallbackTests
Change-Id: I122b62891175cd4a035f3c51c5b6073b34f8fd82

Ken Chen   commited 2023-11-11 11:19:35 +08:00
a10c53cc0d
[BR03.1] Expose isUidNetworkingBlocked
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Bug: 297836825
Change-Id: I70b2351b9cd1c3c6fa34258397e0bf22cb8150b2

Junyu Lai   commited 2023-11-06 13:26:19 +08:00
bb59480733
Use 'set-standby-bucket' instead of 'set-inactive' command.
When 'set-inactive' command is used, it is possible for the
test app to get into the NEVER bucket as it wouldn't be
recorded as used by the user in some cases.

Bug: 298816567
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: If2667a07629b38395d0fed99771488d0900caf18

Sudheer Shanka   commited 2023-10-31 19:50:51 +00:00
c6240e9cfd
Increase the service bind timeout.
Bug: 305826147
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4c137f7fa7827a9794165b86a5cc7ade85f017bf)
Merged-In: I1840e091ebbc9812da56a3522e009ba67a18c476
Change-Id: I1840e091ebbc9812da56a3522e009ba67a18c476

Sudheer Shanka   authored and   Android Build Cherrypicker Worker   commited 2023-10-19 19:19:51 +00:00
bbe0b27ed8
Merge "Remove an NPE in tearDown" into main am: e7b7ceb70d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2770460

Change-Id: I017eafbc7dcf191cf6babcd3c43fa89a66546bbc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Jean Chalard   authored and   Automerger Merge Worker   commited 2023-10-05 03:07:15 +00:00
ddd00cd23a
Remove an NPE in tearDown
This is masking an exception in setUp() and makes debugging difficult

Test: treehugger
Change-Id: I8b5b80c4171d45076dd02bab5ff4b6dc81d98086

Chalard Jean   commited 2023-10-03 16:01:00 +09:00
ec0149f1ba
Merge "Increase the timeout waiting for the test app's network status." into main am: f58fd8442d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2738073

Change-Id: Iebe7d0bc873d13f41cf649a681cf0506ff48833b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Sudheer Shanka   authored and   Automerger Merge Worker   commited 2023-09-08 18:08:02 +00:00
c06c6c594a
Increase the timeout waiting for the test app's network status.
Bug: 298729534
Test: atest com.android.cts.net.HostsideConnOnActivityStartTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:eaf030ea96f3af817e8b301c8edf48f79d7f229d)
Merged-In: I58a23e927cd14b973048e34566350eeef215f7db
Change-Id: I58a23e927cd14b973048e34566350eeef215f7db

Sudheer Shanka   authored and   Android Build Cherrypicker Worker   commited 2023-09-08 06:55:36 +00:00
0f53262c7b
Merge "cts: enforce cubic only on V+" into main am: 4f28615724
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2742375

Change-Id: Ie211602143f6c284016ba21f555b9c8a1eb3466f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Maciej Å»enczykowski   authored and   Automerger Merge Worker   commited 2023-09-06 16:41:36 +00:00
ecbf512dba
Merge "Convert ProcNetTest to JUnit4." into main am: 7d2678c424
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2742376

Change-Id: I95de37cdac802768e13ad1ebbdbd7970b21fc2be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Maciej Å»enczykowski   authored and   Automerger Merge Worker   commited 2023-09-06 16:41:11 +00:00
21fa775301
Merge "Fix lint errors in ProcNetTest." into main am: e491e563a9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2742355

Change-Id: Ic348a7d4f527c56ec8bf8fafb97ba6ca51712258
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Maciej Å»enczykowski   authored and   Automerger Merge Worker   commited 2023-09-06 16:39:40 +00:00
e22bbb4d3c
cts: enforce cubic only on V+
Test: TreeHugger
Bug: 291025434
Bug: 289802481
Bug: 294510745
Change-Id: I3c9646468834305e48c531040640e05f80b1c5e7

Maciej Å»enczykowski   authored and   Lorenzo Colitti   commited 2023-09-06 17:15:54 +09:00
9fe823e34f
Convert ProcNetTest to JUnit4.
This allows using assumptions to skip tests.

Test: atest CtsHostsideNetworkTests
Change-Id: Ic1fc41c1ca0c30b6b7350c413d710d959b9a5013

Lorenzo Colitti   commited 2023-09-06 17:13:17 +09:00
9ae344b81a
Fix lint errors in ProcNetTest.
Test: test-only change
Change-Id: If3702cf9c3a36e3b7cb1853784f1a8ff98d7be07

Lorenzo Colitti   commited 2023-09-06 16:08:00 +09:00
ab5e0c98f0
Only use TEST_APK_NEXT starting from V am: 04d1ce9ea2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2727856

Change-Id: Ibfe3dea23d9e40d62df76059a65bc26734a38849
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Yuyang Huang   authored and   Automerger Merge Worker   commited 2023-09-04 08:08:42 +00:00
e74f645f7d
Only use TEST_APK_NEXT starting from V
The Next app is only necessary in development branches and right now the
in-development SDK is V.

Test: TH
Change-Id: I6aa72d70bc124ae7cf40962b172965d1f0fdb437

Yuyang Huang   commited 2023-09-03 10:21:07 +00:00
04d1ce9ea2
Merge Android U (ab/10368041)
Bug: 291102124
Merged-In: Iff29b090c0b41d0103997a80788f09c2602df074
Change-Id: I5b03523defc88ffbc3aeab9ac8a29b4ca5a11f57

Xin Li   commited 2023-08-25 13:52:17 -07:00
4a6c653160
Disable data saver mode in AbstractRestrictBackgroundNetworkTestCase setup
This test assumes the data saver mode is initially disabled, but WearOS enables the mode on boot. This change fixes the precondition in the setUp method.

Test: run cts -m CtsHostsideNetworkTests
Bug: 280542664
(cherry picked from https://android-review.googlesource.com/q/commit:2cdeffc7e97a915a847cfc40d89e091aeadf20b3)
Merged-In: Ibcceaf0f44821100c861ef7b3c61d0888ae30481
Change-Id: Ibcceaf0f44821100c861ef7b3c61d0888ae30481

Kefan Tu   authored and   Android Build Cherrypicker Worker   commited 2023-08-04 22:02:25 +00:00
f17e3349ba
Skip presubmit for flaky NetworkPolicy related tests due to Out of SLO
Test: TH
Bug: 279052235
Bug: 279829773
Bug: 293225660
Change-Id: I68fe484e920c0c655176fc1909646c721c3eeefe

Junyu Lai   commited 2023-07-26 16:43:42 +08:00
7274332ff3
Skip presubmit for flaky tests in HostsideVpnTests due to Out of SLO
Test: TH
Bug: 291701394
Change-Id: Iea67a9402f2712746c8e7424aacf66f82099700c

Junyu Lai   commited 2023-07-26 16:20:09 +08:00
7eb00f79c3
Merge "Install test app2 per test class for HostsideConnOnActivityStartTest" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-07-19 06:34:17 +00:00
b219cf3caa
Explicitly take app out of app idle state after turning battery on.
When the device is charging, any `am set-inactive` commands would be
effectively no-ops. So, explicitly take the test app out of the app
idle state after changing the charging state.

Bug: 288220398
Test: atest services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueTest.java
Test: atest services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueModernImplTest.java
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9290fb85fe3c16c1a424ffe32769c5b2927b4b74)
Merged-In: I152af12b404ac607fff794a527f45a0aad640d4f
Change-Id: I152af12b404ac607fff794a527f45a0aad640d4f

Sudheer Shanka   authored and   Android Build Cherrypicker Worker   commited 2023-07-18 22:42:57 +00:00
e32d8bcf98
Merge "Disable battery saver at the end of the test run." into main
Sudheer Shanka   authored and   Gerrit Code Review   commited 2023-07-14 18:49:05 +00:00
472d72f7da
Disable battery saver at the end of the test run.
Bug: 290200790
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Ic1302096e5f27b2af46b0e730569373e7739664a

Sudheer Shanka   commited 2023-07-14 06:38:51 +00:00
7261422eab
Install test app2 per test class for HostsideConnOnActivityStartTest
With installing test apps per test class instead of test cases,
the total execution time tests are improved from 1m56s to 1m34s
in local trials.

Notes: 1. This is a demonstration CL to other Hostside*Tests to show
          how to make app2 can be installed per test class.
       2. The method that executed per test class should not shadow
          the method in the base class, see the doc of @BeforeClass.

Test: atest HostsideConnOnActivityStartTest
Bug: 289002798
Change-Id: Ia9875f0a9fdcb4fb4c55736034b56aad0491d451

Junyu Lai   commited 2023-07-14 10:54:57 +08:00
06e9c0001c
Temporarily include jobscheduler service dump in failure logs.
Bug: 288220398
Test: TH
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:0065eb5687ea8b63c47cb53fe139ee9039f512f0)
Merged-In: Ife54baabed63b54f9cf0e98c4787ff48c403bc9b
Change-Id: Ife54baabed63b54f9cf0e98c4787ff48c403bc9b

Sudheer Shanka   authored and   Android Build Cherrypicker Worker   commited 2023-07-12 22:25:41 +00:00
44ff752768
Temporarily include platform_compat service dump in failure logs.
Bug: 279829773
Test: TH
Ignore-AOSP-First: temporary change
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ab6b38c90c246d0d89298be8aa8776994e30c7fc)
Merged-In: I1f6795042f8a822359e089d7b9da4de0f8934a09
Change-Id: I1f6795042f8a822359e089d7b9da4de0f8934a09

Sudheer Shanka   authored and   Android Build Cherrypicker Worker   commited 2023-07-12 20:16:26 +00:00
944b7487db
Merge "Install test app1 per test class" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-07-12 09:07:29 +00:00
319afd7ea2