Skip to content

Commit 52d19dd

Browse files
authored
Increased wait time of the false-positive assertions in some integration tests to make github CI stable. (#124)
1 parent cff06bb commit 52d19dd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

bifromq-retain/bifromq-retain-store/src/test/java/com/baidu/bifromq/retain/store/LoadMetadataTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import static org.testng.Assert.assertNotSame;
1818

1919
import io.micrometer.core.instrument.Gauge;
20+
import java.time.Duration;
2021
import org.testng.annotations.BeforeMethod;
2122
import org.testng.annotations.Test;
2223

@@ -34,8 +35,8 @@ public void testLoadMetadata() {
3435
requestRetain(tenantId, message("/b", "hello"));
3536
Gauge spaceUsageGauge = getSpaceUsageGauge(tenantId);
3637
Gauge retainCountGauge = getRetainCountGauge(tenantId);
37-
await().until(() -> spaceUsageGauge.value() > 0);
38-
await().until(() -> retainCountGauge.value() == 2);
38+
await().atMost(Duration.ofSeconds(20)).until(() -> spaceUsageGauge.value() > 0);
39+
await().atMost(Duration.ofSeconds(20)).until(() -> retainCountGauge.value() == 2);
3940

4041
restartStoreServer();
4142
storeClient.join();
@@ -44,7 +45,7 @@ public void testLoadMetadata() {
4445
Gauge newRetainCountGauge = getRetainCountGauge(tenantId);
4546
assertNotSame(spaceUsageGauge, newSpaceUsageGauge);
4647
assertNotSame(retainCountGauge, newRetainCountGauge);
47-
await().until(() -> newSpaceUsageGauge.value() > 0);
48-
await().until(() -> newRetainCountGauge.value() == 2);
48+
await().atMost(Duration.ofSeconds(20)).until(() -> newSpaceUsageGauge.value() > 0);
49+
await().atMost(Duration.ofSeconds(20)).until(() -> newRetainCountGauge.value() == 2);
4950
}
5051
}

bifromq-retain/bifromq-retain-store/src/test/java/com/baidu/bifromq/retain/store/RetainStoreTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ public void tearDown() throws Exception {
181181
closeable.close();
182182
}
183183

184-
185184
protected RetainResult.Code requestRetain(String tenantId, TopicMessage topicMsg) {
186185
long reqId = ThreadLocalRandom.current().nextInt();
187186
ByteString tenantNS = KVSchemaUtil.tenantBeginKey(tenantId);
@@ -266,7 +265,7 @@ protected void assertNoGauge(String tenantId, TenantMetric gaugeMetric) {
266265

267266
protected Gauge getGauge(String tenantId, TenantMetric gaugeMetric) {
268267
AtomicReference<Gauge> holder = new AtomicReference<>();
269-
await().until(() -> {
268+
await().atMost(Duration.ofSeconds(20)).until(() -> {
270269
for (Meter meter : meterRegistry.getMeters()) {
271270
if (meter.getId().getType() == Meter.Type.GAUGE &&
272271
meter.getId().getName().equals(gaugeMetric.metricName) &&

0 commit comments

Comments
 (0)