IpManagerTest: fix flaky test

Reset the callback mock for every onLinkPropertiesChange expected when
pushing address updates on the BaseNetworkObserver.

Bug: 32561414
Bug: 62918393
Test: runtest frameworks-net, IpManagerTest passes 200 times in a row
Change-Id: I4719b4dc86044438243887634191c2d21686b80f
This commit is contained in:
Hugo Benichi
2017-09-07 14:18:33 +09:00
parent 2a94ac555e
commit 25c7f49ff3

View File

@@ -180,7 +180,8 @@ public class IpManagerTest {
// Add N - 1 addresses
for (int i = 0; i < lastAddr; i++) {
mObserver.addressUpdated(iface, new LinkAddress(addresses[i]));
verify(mCb, timeout(100).times(1)).onLinkPropertiesChange(any());
verify(mCb, timeout(100)).onLinkPropertiesChange(any());
reset(mCb);
}
// Add Nth address