Commit Graph

10 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
48380e4132 Revert EXCLUDED_ROUTES to only keep RTN_UNICAST
Revert the previous change to filter out all non-RTN_THROW routes when
EXCLUDED_ROUTES is disabled, as that behavior is CTS tested for T, and
has been used by T for a while. The previous change already ensured that
there is no behavior change on S, so this is the safest approach.

This fixes HostsideLinkPropertiesGatingTests.

Bug: 239046959
Test: atest LinkPropertiesTest CtsHostsideNetworkTests
Change-Id: I55e078cdc06341f4957fe7bc743c0022b2c7d3da
2022-07-15 16:46:14 +09:00
Remi NGUYEN VAN
66c27c18a2 Let LinkProperties#getRoutes() keeps returning all routes before T
Starting from T, VpnService supports exclude routes, which will
make the caller to get both of include routes and exclude routes
from LinkProperties#getRoutes(), and it's not expected to get the
exclude routes before T in production code even though the code
returns all routes.

But there is a CTS - LinkPropertiesTest#testRouteAddWithSameKey()
will try to add an exclude route and check if the result of
LinkProperties#getRoutes() contains that exclude route or not.
And the test is failed now since LinkProperties#getRoutes() will
only return include route if compat feature - EXCLUDED_ROUTES is
disabled. (EXCLUDED_ROUTES is enabled starting from target SDK T)

To fix this test failure, let LinkProperties#getRoutes() keeps
returning all routes if SDK is before T. This avoids changing
behavior on S, and even though there is still a behavior change
when upgrading to T, apps are unlikely to be relying on such
behavior, especially outside of tests.

Bug: 238061814
Test: Run "atest CtsNetTestCases:LinkPropertiesTest" on S build
      with mainline module which contains this patch.
Change-Id: Iac4362c4fe347ee3f06d5b21b0325fa69a7f27b6
2022-07-14 18:54:05 +09:00
Lorenzo Colitti
1bb94a3490 Fix LinkProperties exclude routes tests on user builds.
The tests fail on user builds because they target T and attempt
to override the compat change, which is not allowed on user
builds because the change defaults to on for apps targeting T+.
Fix this by marking the tests max target SDK 31.

Also improve the tests a bit:

- Use a RuleChain to make it explicit that
  CtsNetTestCasesMaxTargetSdk31 should be evaluated before
  EnableCompatChanges (otherwise the compat change rule would
  crash on user builds even if the max target SDK rule was going
  to skip the test anyway).

- Fix the IgnoreUpTo for all exclude route tests to say S+.
  Currently:
  - One says R+, which is incorrect because the updated
    LinkProperties code is in the connectivity module, which only
    goes back to S, not R.
  - The others say T+, which is incorrect because the update code
    is present on S.

Fix: 233553525
Test: LinkProperties test in CtsNetTestCasesLatestSdk passes on T user build
Test: LinkProperties test in CtsNetTestCasesMaxTargetSdk31 passes on T user build
Change-Id: Ie0e2f6761b90a65813ed3610c7b5e930a9fdc982
2022-06-13 02:01:35 +00:00
Lorenzo Colitti
1c7a20c6c6 Run testExcludedRoutesDisabled only in APKs with target SDK < T.
This test crashes if run from an APK that has target SDK 33 or
above because it tries to disable a compat change that on those
SDK versions is enabled by default.

Run it only in CtsNetTestCasesMaxTargetSdk31 and skip it in our
regular CTS modules.

Bug: 233553525
Test: test-only change
Change-Id: Iaf9c46591c13505c9d2a2a09994b9ee22a22390c
2022-05-30 23:36:23 +09:00
preranap
ee4bfe7d3a Follow-up changes to Update VPN isolation code for excluded routes
Making changes in the hasExcludeRoute() with more realistic values as
suggested in CL 18173562(https://googleplex-android-review.git.corp.google.com/c/platform/packages/modules/Connectivity/+/18173562) by Lorenzo

Bug: 230058738
Test: atest LinkPropertiesTest
Change-Id: Ic0ea1e83fbe5bfec98b0060ba1a9635d5ba710e1
(cherry picked from commit 6c36b00662df8ccffb2ce49daa04b358c38f1b3e)
2022-05-13 00:26:27 +00:00
Prerana
2b97bbebf4 Update VPN isolation code for excluded routes
Bug: 230058738
Test: atest LinkPropertiesTest

Result: https://paste.googleplex.com/4706859672928256

Change-Id: I970fca6b0e2cd358e9bd77152563d13367867c74
2022-04-29 22:23:02 +00:00
Taras Antoshchuk
30d41e59bc Filter out excluded routes in LinkProperties
Gate presence of excluded routes in LinkProperties on target sdk T.

Bug: 186082280
Test: atest LinkPropertiesTest
Change-Id: If8fdb468a0a4968c5f2a878b7aacfeb4f7d9a9e5
2022-04-13 01:17:56 +02:00
Remi NGUYEN VAN
e347301890 Mark connectivity module tests as such
Add @ConnectivityModuleTest to tests for classes that are mainly used to
back the connectivity (tethering) module, in particular data classes.

This causes the test not to be run in NetworkStack/CaptivePortalLogin
MTS tests when the connectivity (tethering) module is not installed.
Skipping such tests is necessary in that configuration as they may test
behavior that is new in the latest update, and data classes backing the
connectivity module would not be affected by
NetworkStack/CaptivePortalLogin updates anyway.

Bug: 211075897
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I6163cd998fc78765b903fdb7acd21e652bc711c9
2022-01-18 16:55:44 +09:00
Remi NGUYEN VAN
8bc36966d4 Do not verify field count in tests used in CTS
Tests in tests/common and tests/cts are run as part of CtsNetTestCases.
Many used assertFieldCountEquals in parceling/unparceling tests to
ensure that unexpected fields were not added, or that they were not
missed when testing parceling/unparceling.

However with many of the classes updatable through module updates, the
field count may change in the future, breaking CTS tests.

Stop checking for the field count, as it would break on module releases,
and its value is lower than the maintenance cost.

Bug: 205901761
Test: atest CtsNetTestCases
Change-Id: I79854741f7e834574d4825bb737ef507785310fe
2022-01-18 16:55:32 +09:00
Remi NGUYEN VAN
5ed250d90a Move net unit tests to packages/Connectivity
Move the tests together with packages/Connectivity code, so both can be
moved to packages/modules/Connectivity together.

Also reorganize unit tests in a unit/ directory, as other tests
(integration/, common/ etc.) have been added in tests/net since they
were created. This makes the directory structure consistent.

Test: atest FrameworksNetTests
Bug: 187814163
Merged-In: I254ffd1c08ec058d594b4ea55cbae5505f8497cc

Change-Id: I254ffd1c08ec058d594b4ea55cbae5505f8497cc
2021-05-13 08:30:33 +00:00