Skip to content

Commit df54ba9

Browse files
authored
Fix Thread#sleep in ClientStatsTest (#1904)
1 parent 745a7bc commit df54ba9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

client/src/test/java/org/asynchttpclient/ClientStatsTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package org.asynchttpclient;
1717

18-
import io.github.artsok.RepeatedIfExceptionsTest;
18+
import org.junit.jupiter.api.Test;
1919

2020
import java.time.Duration;
2121
import java.util.List;
@@ -34,7 +34,7 @@ public class ClientStatsTest extends AbstractBasicTest {
3434

3535
private static final String hostname = "localhost";
3636

37-
@RepeatedIfExceptionsTest(repeats = 5)
37+
@Test
3838
public void testClientStatus() throws Throwable {
3939
try (final AsyncHttpClient client = asyncHttpClient(config().setKeepAlive(true).setPooledConnectionIdleTimeout(Duration.ofSeconds(5)))) {
4040
final String url = getTargetUrl();
@@ -51,7 +51,7 @@ public void testClientStatus() throws Throwable {
5151
.limit(5)
5252
.collect(Collectors.toList());
5353

54-
Thread.sleep(2000 + 1000);
54+
Thread.sleep(2000);
5555

5656
final ClientStats activeStats = client.getClientStats();
5757

@@ -63,7 +63,7 @@ public void testClientStatus() throws Throwable {
6363

6464
futures.forEach(future -> future.toCompletableFuture().join());
6565

66-
Thread.sleep(1000 + 1000);
66+
Thread.sleep(1000);
6767

6868
final ClientStats idleStats = client.getClientStats();
6969

@@ -79,7 +79,7 @@ public void testClientStatus() throws Throwable {
7979
.limit(3)
8080
.collect(Collectors.toList());
8181

82-
Thread.sleep(2000 + 1000);
82+
Thread.sleep(2000);
8383

8484
final ClientStats activeCachedStats = client.getClientStats();
8585

@@ -91,7 +91,7 @@ public void testClientStatus() throws Throwable {
9191

9292
repeatedFutures.forEach(future -> future.toCompletableFuture().join());
9393

94-
Thread.sleep(1000 + 1000);
94+
Thread.sleep(1000);
9595

9696
final ClientStats idleCachedStats = client.getClientStats();
9797

@@ -101,7 +101,7 @@ public void testClientStatus() throws Throwable {
101101
assertEquals(3, idleCachedStats.getTotalConnectionCount());
102102
assertEquals(3, idleCachedStats.getStatsPerHost().get(hostname).getHostConnectionCount());
103103

104-
Thread.sleep(5000 + 1000);
104+
Thread.sleep(5000);
105105

106106
final ClientStats timeoutStats = client.getClientStats();
107107

@@ -113,7 +113,7 @@ public void testClientStatus() throws Throwable {
113113
}
114114
}
115115

116-
@RepeatedIfExceptionsTest(repeats = 5)
116+
@Test
117117
public void testClientStatusNoKeepalive() throws Throwable {
118118
try (final AsyncHttpClient client = asyncHttpClient(config().setKeepAlive(false).setPooledConnectionIdleTimeout(Duration.ofSeconds(1)))) {
119119
final String url = getTargetUrl();
@@ -130,7 +130,7 @@ public void testClientStatusNoKeepalive() throws Throwable {
130130
.limit(5)
131131
.collect(Collectors.toList());
132132

133-
Thread.sleep(2000 + 1000);
133+
Thread.sleep(2000);
134134

135135
final ClientStats activeStats = client.getClientStats();
136136

@@ -142,7 +142,7 @@ public void testClientStatusNoKeepalive() throws Throwable {
142142

143143
futures.forEach(future -> future.toCompletableFuture().join());
144144

145-
Thread.sleep(1000 + 1000);
145+
Thread.sleep(1000);
146146

147147
final ClientStats idleStats = client.getClientStats();
148148

@@ -158,7 +158,7 @@ public void testClientStatusNoKeepalive() throws Throwable {
158158
.limit(3)
159159
.collect(Collectors.toList());
160160

161-
Thread.sleep(2000 + 1000);
161+
Thread.sleep(2000);
162162

163163
final ClientStats activeCachedStats = client.getClientStats();
164164

@@ -170,7 +170,7 @@ public void testClientStatusNoKeepalive() throws Throwable {
170170

171171
repeatedFutures.forEach(future -> future.toCompletableFuture().join());
172172

173-
Thread.sleep(1000 + 1000);
173+
Thread.sleep(1000);
174174

175175
final ClientStats idleCachedStats = client.getClientStats();
176176

0 commit comments

Comments
 (0)