Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import static org.testng.Assert.assertNotSame;

import io.micrometer.core.instrument.Gauge;
import java.time.Duration;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

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

restartStoreServer();
storeClient.join();
Expand All @@ -44,7 +45,7 @@ public void testLoadMetadata() {
Gauge newRetainCountGauge = getRetainCountGauge(tenantId);
assertNotSame(spaceUsageGauge, newSpaceUsageGauge);
assertNotSame(retainCountGauge, newRetainCountGauge);
await().until(() -> newSpaceUsageGauge.value() > 0);
await().until(() -> newRetainCountGauge.value() == 2);
await().atMost(Duration.ofSeconds(20)).until(() -> newSpaceUsageGauge.value() > 0);
await().atMost(Duration.ofSeconds(20)).until(() -> newRetainCountGauge.value() == 2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ public void tearDown() throws Exception {
closeable.close();
}


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

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