diff options
| author | 2019-01-24 16:36:27 -0800 | |
|---|---|---|
| committer | 2019-01-24 16:36:27 -0800 | |
| commit | 618ff5185a671263bf7a9cebda30d2659cbee7da (patch) | |
| tree | ae0f5683367e8584a9a88f21fcc5c05ac8c99b1d | |
| parent | 12b8ba166736cb1497e3a9c14abe1607cfb04679 (diff) | |
| parent | 1f9d80f6eebc26615e14fdbab5ee8461f70aa589 (diff) | |
Merge "Fix IPMS tests timeout."
am: 1f9d80f6ee
Change-Id: Ia73f410da8c42e9933dd290deacb82909b4348a6
| -rw-r--r-- | tests/net/java/com/android/server/net/ipmemorystore/IpMemoryStoreServiceTest.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/net/java/com/android/server/net/ipmemorystore/IpMemoryStoreServiceTest.java b/tests/net/java/com/android/server/net/ipmemorystore/IpMemoryStoreServiceTest.java index f2ecef95b599..e57433a52cca 100644 --- a/tests/net/java/com/android/server/net/ipmemorystore/IpMemoryStoreServiceTest.java +++ b/tests/net/java/com/android/server/net/ipmemorystore/IpMemoryStoreServiceTest.java @@ -202,9 +202,11 @@ public class IpMemoryStoreServiceTest { final CountDownLatch latch = new CountDownLatch(1); functor.accept(latch); try { - latch.await(5000, TimeUnit.MILLISECONDS); + if (!latch.await(5000, TimeUnit.MILLISECONDS)) { + fail(timeoutMessage); + } } catch (InterruptedException e) { - fail(timeoutMessage); + fail("Thread was interrupted"); } } @@ -314,6 +316,7 @@ public class IpMemoryStoreServiceTest { assertEquals(Status.ERROR_ILLEGAL_ARGUMENT, status.resultCode); assertNull(key); assertNull(attr); + latch.countDown(); }))); } @@ -383,6 +386,7 @@ public class IpMemoryStoreServiceTest { assertTrue("Retrieve network sameness not successful : " + status.resultCode, status.isSuccess()); assertEquals(FAKE_KEYS[5], key); + latch.countDown(); }))); // MTU matches key 4 but v4 address matches key 5. The latter is stronger. @@ -392,6 +396,7 @@ public class IpMemoryStoreServiceTest { assertTrue("Retrieve network sameness not successful : " + status.resultCode, status.isSuccess()); assertEquals(FAKE_KEYS[5], key); + latch.countDown(); }))); // Closest to key 3 (indeed, identical) @@ -402,6 +407,7 @@ public class IpMemoryStoreServiceTest { assertTrue("Retrieve network sameness not successful : " + status.resultCode, status.isSuccess()); assertEquals(FAKE_KEYS[3], key); + latch.countDown(); }))); // Group hint alone must not be strong enough to override the rest @@ -411,6 +417,7 @@ public class IpMemoryStoreServiceTest { assertTrue("Retrieve network sameness not successful : " + status.resultCode, status.isSuccess()); assertEquals(FAKE_KEYS[3], key); + latch.countDown(); }))); // Still closest to key 3, though confidence is lower @@ -421,6 +428,7 @@ public class IpMemoryStoreServiceTest { assertTrue("Retrieve network sameness not successful : " + status.resultCode, status.isSuccess()); assertEquals(FAKE_KEYS[3], key); + latch.countDown(); }))); // But changing the MTU makes this closer to key 4 @@ -430,6 +438,7 @@ public class IpMemoryStoreServiceTest { assertTrue("Retrieve network sameness not successful : " + status.resultCode, status.isSuccess()); assertEquals(FAKE_KEYS[4], key); + latch.countDown(); }))); // MTU alone not strong enough to make this group-close @@ -441,6 +450,7 @@ public class IpMemoryStoreServiceTest { assertTrue("Retrieve network sameness not successful : " + status.resultCode, status.isSuccess()); assertNull(key); + latch.countDown(); }))); } @@ -450,6 +460,7 @@ public class IpMemoryStoreServiceTest { assertTrue("Retrieve network sameness not successful : " + status.resultCode, status.isSuccess()); assertEquals(sameness, answer.getNetworkSameness()); + latch.countDown(); }))); } @@ -488,6 +499,7 @@ public class IpMemoryStoreServiceTest { + status.resultCode, status.isSuccess()); assertEquals(Status.ERROR_ILLEGAL_ARGUMENT, status.resultCode); assertNull(answer); + latch.countDown(); }))); } } |