Test races around NetworkAgent creation.
This adds tests for bugs that were introduced when we enabled
early native network creation. The tests pass on current builds
because the feature is disabled, but break if the feature is
re-enabled without fixing the races.
Specifically:
- Add a test that registers/unregister/registers agents in a
loop. This checks for a race between unregister() and
register() which exists because unlike register(),
unregister() has to wait for the agent channel to be
connected.
- Add a test for calling unregisterAfterReplacement multiple
times on the same interface. This tests for the race seen
in b/286649301#comment6 , where calling
unregisterAfterReplacement twice and then registering a third
agent will cause the second agent to be torn down after the
third is registered.
Bug: 296355968
Test: test-only change
Change-Id: I3d798209740273e5ce59b278af41dd2ad9470916
1 file changed