Skip to content

Commit 202363b

Browse files
authored
Merge pull request apolloconfig#535 from nobodyiam/fix-ut
enlarge sleep interval for ut
2 parents 3e4ce84 + 1b3006b commit 202363b

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/NotificationControllerV2Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public void testPollNotificationWithHandleMessageInBatch() throws Exception {
330330

331331
assertTrue(!anotherDeferredResult.hasResult());
332332

333-
TimeUnit.MILLISECONDS.sleep(someBatchInterval * 5);
333+
TimeUnit.MILLISECONDS.sleep(someBatchInterval * 10);
334334

335335
assertTrue(anotherDeferredResult.hasResult());
336336
}

apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/AppNamespaceServiceWithCacheTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public void testAppNamespace() throws Exception {
7474
String anotherPrivateNamespace = "anotherPrivateNamespace";
7575
long anotherPrivateNamespaceId = 3;
7676

77+
int sleepInterval = scanInterval * 10;
78+
7779
AppNamespace somePrivateAppNamespace = assembleAppNamespace(somePrivateNamespaceId,
7880
someAppId, somePrivateNamespace, false);
7981
AppNamespace somePublicAppNamespace = assembleAppNamespace(somePublicNamespaceId,
@@ -116,7 +118,7 @@ public void testAppNamespace() throws Exception {
116118
somePublicNamespaceId))).thenReturn(Lists.newArrayList(somePrivateAppNamespace,
117119
somePublicAppNamespace));
118120

119-
scanIntervalTimeUnit.sleep(scanInterval * 3);
121+
scanIntervalTimeUnit.sleep(sleepInterval);
120122

121123
check(Lists.newArrayList(somePrivateAppNamespace), appNamespaceServiceWithCache
122124
.findByAppIdAndNamespaces(someAppId, someAppIdNamespaces));
@@ -131,7 +133,7 @@ public void testAppNamespace() throws Exception {
131133
anotherPublicAppNamespace));
132134
when(appNamespaceRepository.findAll(appNamespaceIds)).thenReturn(allAppNamespaces);
133135

134-
scanIntervalTimeUnit.sleep(scanInterval * 3);
136+
scanIntervalTimeUnit.sleep(sleepInterval);
135137

136138
check(Lists.newArrayList(somePrivateAppNamespace, yetAnotherPrivateAppNamespace,
137139
anotherPublicAppNamespace), appNamespaceServiceWithCache.findByAppIdAndNamespaces
@@ -169,7 +171,7 @@ public void testAppNamespace() throws Exception {
169171
when(appNamespaceRepository.findAll(appNamespaceIds)).thenReturn(Lists.newArrayList
170172
(somePrivateAppNamespaceNew, yetAnotherPrivateAppNamespaceNew, somePublicAppNamespaceNew));
171173

172-
scanIntervalTimeUnit.sleep(scanInterval * 3);
174+
scanIntervalTimeUnit.sleep(sleepInterval);
173175

174176
check(Collections.emptyList(), appNamespaceServiceWithCache
175177
.findByAppIdAndNamespaces(someAppId, someAppIdNamespaces));

apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/ReleaseMessageServiceWithCacheTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public void testNewReleaseMessagesBeforeHandleMessage() throws Exception {
177177
when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(someMessageId)).thenReturn(Lists
178178
.newArrayList(newMessage));
179179

180-
scanIntervalTimeUnit.sleep(scanInterval * 3);
180+
scanIntervalTimeUnit.sleep(scanInterval * 10);
181181

182182
ReleaseMessage newLatestReleaseMsg =
183183
releaseMessageServiceWithCache

0 commit comments

Comments
 (0)