Commit 202363b5 authored by 张乐's avatar 张乐 Committed by GitHub

Merge pull request #535 from nobodyiam/fix-ut

enlarge sleep interval for ut
parents 3e4ce84c 1b3006be
...@@ -330,7 +330,7 @@ public class NotificationControllerV2Test { ...@@ -330,7 +330,7 @@ public class NotificationControllerV2Test {
assertTrue(!anotherDeferredResult.hasResult()); assertTrue(!anotherDeferredResult.hasResult());
TimeUnit.MILLISECONDS.sleep(someBatchInterval * 5); TimeUnit.MILLISECONDS.sleep(someBatchInterval * 10);
assertTrue(anotherDeferredResult.hasResult()); assertTrue(anotherDeferredResult.hasResult());
} }
......
...@@ -74,6 +74,8 @@ public class AppNamespaceServiceWithCacheTest { ...@@ -74,6 +74,8 @@ public class AppNamespaceServiceWithCacheTest {
String anotherPrivateNamespace = "anotherPrivateNamespace"; String anotherPrivateNamespace = "anotherPrivateNamespace";
long anotherPrivateNamespaceId = 3; long anotherPrivateNamespaceId = 3;
int sleepInterval = scanInterval * 10;
AppNamespace somePrivateAppNamespace = assembleAppNamespace(somePrivateNamespaceId, AppNamespace somePrivateAppNamespace = assembleAppNamespace(somePrivateNamespaceId,
someAppId, somePrivateNamespace, false); someAppId, somePrivateNamespace, false);
AppNamespace somePublicAppNamespace = assembleAppNamespace(somePublicNamespaceId, AppNamespace somePublicAppNamespace = assembleAppNamespace(somePublicNamespaceId,
...@@ -116,7 +118,7 @@ public class AppNamespaceServiceWithCacheTest { ...@@ -116,7 +118,7 @@ public class AppNamespaceServiceWithCacheTest {
somePublicNamespaceId))).thenReturn(Lists.newArrayList(somePrivateAppNamespace, somePublicNamespaceId))).thenReturn(Lists.newArrayList(somePrivateAppNamespace,
somePublicAppNamespace)); somePublicAppNamespace));
scanIntervalTimeUnit.sleep(scanInterval * 3); scanIntervalTimeUnit.sleep(sleepInterval);
check(Lists.newArrayList(somePrivateAppNamespace), appNamespaceServiceWithCache check(Lists.newArrayList(somePrivateAppNamespace), appNamespaceServiceWithCache
.findByAppIdAndNamespaces(someAppId, someAppIdNamespaces)); .findByAppIdAndNamespaces(someAppId, someAppIdNamespaces));
...@@ -131,7 +133,7 @@ public class AppNamespaceServiceWithCacheTest { ...@@ -131,7 +133,7 @@ public class AppNamespaceServiceWithCacheTest {
anotherPublicAppNamespace)); anotherPublicAppNamespace));
when(appNamespaceRepository.findAll(appNamespaceIds)).thenReturn(allAppNamespaces); when(appNamespaceRepository.findAll(appNamespaceIds)).thenReturn(allAppNamespaces);
scanIntervalTimeUnit.sleep(scanInterval * 3); scanIntervalTimeUnit.sleep(sleepInterval);
check(Lists.newArrayList(somePrivateAppNamespace, yetAnotherPrivateAppNamespace, check(Lists.newArrayList(somePrivateAppNamespace, yetAnotherPrivateAppNamespace,
anotherPublicAppNamespace), appNamespaceServiceWithCache.findByAppIdAndNamespaces anotherPublicAppNamespace), appNamespaceServiceWithCache.findByAppIdAndNamespaces
...@@ -169,7 +171,7 @@ public class AppNamespaceServiceWithCacheTest { ...@@ -169,7 +171,7 @@ public class AppNamespaceServiceWithCacheTest {
when(appNamespaceRepository.findAll(appNamespaceIds)).thenReturn(Lists.newArrayList when(appNamespaceRepository.findAll(appNamespaceIds)).thenReturn(Lists.newArrayList
(somePrivateAppNamespaceNew, yetAnotherPrivateAppNamespaceNew, somePublicAppNamespaceNew)); (somePrivateAppNamespaceNew, yetAnotherPrivateAppNamespaceNew, somePublicAppNamespaceNew));
scanIntervalTimeUnit.sleep(scanInterval * 3); scanIntervalTimeUnit.sleep(sleepInterval);
check(Collections.emptyList(), appNamespaceServiceWithCache check(Collections.emptyList(), appNamespaceServiceWithCache
.findByAppIdAndNamespaces(someAppId, someAppIdNamespaces)); .findByAppIdAndNamespaces(someAppId, someAppIdNamespaces));
......
...@@ -177,7 +177,7 @@ public class ReleaseMessageServiceWithCacheTest { ...@@ -177,7 +177,7 @@ public class ReleaseMessageServiceWithCacheTest {
when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(someMessageId)).thenReturn(Lists when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(someMessageId)).thenReturn(Lists
.newArrayList(newMessage)); .newArrayList(newMessage));
scanIntervalTimeUnit.sleep(scanInterval * 3); scanIntervalTimeUnit.sleep(scanInterval * 10);
ReleaseMessage newLatestReleaseMsg = ReleaseMessage newLatestReleaseMsg =
releaseMessageServiceWithCache releaseMessageServiceWithCache
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment