You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by yc...@apache.org on 2025/02/05 18:18:42 UTC
(cassandra-sidecar) branch trunk updated: CASSSIDECAR-196: Fixes StreamStatsIntegrationTest flaky test (#185)
This is an automated email from the ASF dual-hosted git repository.
ycai pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-sidecar.git
The following commit(s) were added to refs/heads/trunk by this push:
new 85261c2d CASSSIDECAR-196: Fixes StreamStatsIntegrationTest flaky test (#185)
85261c2d is described below
commit 85261c2d9d947e557b4f0f8974a55ba12903ebb0
Author: Arjun Ashok <ar...@apple.com>
AuthorDate: Wed Feb 5 10:18:38 2025 -0800
CASSSIDECAR-196: Fixes StreamStatsIntegrationTest flaky test (#185)
Patch by Arjun Ashok; Reviewed by Francisco Guerrero, Yifan Cai for CASSSIDECAR-196
---
.../sidecar/routes/StreamStatsIntegrationTest.java | 36 +++++++++-------------
1 file changed, 14 insertions(+), 22 deletions(-)
diff --git a/server/src/test/integration/org/apache/cassandra/sidecar/routes/StreamStatsIntegrationTest.java b/server/src/test/integration/org/apache/cassandra/sidecar/routes/StreamStatsIntegrationTest.java
index 809f9cb4..6356ab3f 100644
--- a/server/src/test/integration/org/apache/cassandra/sidecar/routes/StreamStatsIntegrationTest.java
+++ b/server/src/test/integration/org/apache/cassandra/sidecar/routes/StreamStatsIntegrationTest.java
@@ -20,7 +20,6 @@ package org.apache.cassandra.sidecar.routes;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -53,6 +52,7 @@ import org.apache.cassandra.testing.CassandraIntegrationTest;
import org.apache.cassandra.testing.ConfigurableCassandraTestContext;
import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.apache.cassandra.testing.utils.AssertionUtils.getBlocking;
import static org.apache.cassandra.testing.utils.AssertionUtils.loopAssert;
import static org.assertj.core.api.Assertions.assertThat;
@@ -82,10 +82,13 @@ public class StreamStatsIntegrationTest extends IntegrationTestBase
awaitLatchOrThrow(BBHelperDecommissioningNode.transientStateStart, 2, TimeUnit.MINUTES, "transientStateStart");
// optimal no. of attempts to poll for stats to capture streaming stats during node decommissioning
- loopAssert(10, 200, () -> {
- streamStats(hasStats, dataReceived);
+ loopAssert(15, 200, () -> {
+ StreamsProgressStats progressStats = streamStats(hasStats, dataReceived);
assertThat(hasStats).isTrue();
- assertThat(dataReceived).isTrue();
+ assertThat(dataReceived)
+ .describedAs("Stream Progress Stats - totalFilesReceived:" + progressStats.totalFilesReceived() +
+ " totalBytesReceived:" + progressStats.totalBytesReceived())
+ .isTrue();
});
ClusterUtils.awaitGossipStatus(node, node, "LEFT");
BBHelperDecommissioningNode.transientStateEnd.countDown();
@@ -94,26 +97,16 @@ public class StreamStatsIntegrationTest extends IntegrationTestBase
context.awaitCompletion(2, TimeUnit.MINUTES);
}
- private void streamStats(AtomicBoolean hasStats, AtomicBoolean dataReceived)
+ private StreamsProgressStats streamStats(AtomicBoolean hasStats, AtomicBoolean dataReceived)
{
String testRoute = "/api/v1/cassandra/stats/streams";
HttpResponse<Buffer> resp;
- try
- {
- resp = client.get(server.actualPort(), "127.0.0.1", testRoute)
- .send()
- .toCompletionStage()
- .toCompletableFuture()
- .get();
- assertStreamStatsResponseOK(resp, hasStats, dataReceived);
- }
- catch (InterruptedException | ExecutionException e)
- {
- throw new RuntimeException(e);
- }
+ resp = getBlocking(client.get(server.actualPort(), "127.0.0.1", testRoute)
+ .send());
+ return assertStreamStatsResponseOK(resp, hasStats, dataReceived);
}
- void assertStreamStatsResponseOK(HttpResponse<Buffer> response, AtomicBoolean hasStats, AtomicBoolean dataReceived)
+ StreamsProgressStats assertStreamStatsResponseOK(HttpResponse<Buffer> response, AtomicBoolean hasStats, AtomicBoolean dataReceived)
{
assertThat(response.statusCode()).isEqualTo(HttpResponseStatus.OK.code());
StreamStatsResponse streamStatsResponse = response.bodyAsJson(StreamStatsResponse.class);
@@ -123,14 +116,13 @@ public class StreamStatsIntegrationTest extends IntegrationTestBase
if (streamProgress.totalFilesToReceive() > 0)
{
hasStats.set(true);
- if (streamProgress.totalFilesToReceive() == streamProgress.totalFilesReceived() &&
- streamProgress.totalFilesReceived() > 0)
+ if (streamProgress.totalFilesReceived() > 0)
{
dataReceived.set(true);
- assertThat(streamProgress.totalBytesToReceive()).isEqualTo(streamProgress.totalBytesReceived());
assertThat(streamProgress.totalBytesReceived()).isGreaterThan(0);
}
}
+ return streamProgress;
}
QualifiedTableName createTestTableAndPopulate()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org