From 9b3bde6f3148c5dd75ba8f7082af07c1d93f704f Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Tue, 1 Sep 2026 08:10:00 -0700 Subject: [PATCH] Fix flaky ReaderSeekTest: avoid topic name collision between test instances testSeekToEndByTimestamp and testHasMessageAvailableAfterSeekToEnd name their topic with only a second-granularity timestamp, but gtest-parallel runs the /0 and /1 parameter instances as separate concurrent processes. When both start within the same second they share the same topic, and one instance's publish can land after the other's seek-to-end but before its hasMessageAvailable() check, which then correctly returns true and fails the assertion. Retries keep colliding the same way, so the whole job fails. Append GetParam() to the topic names so the two parameter instances never share a topic, matching the convention used by the other parameterized tests in this file. --- tests/ReaderTest.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ReaderTest.cc b/tests/ReaderTest.cc index 302df1f7..260c12f7 100644 --- a/tests/ReaderTest.cc +++ b/tests/ReaderTest.cc @@ -852,7 +852,8 @@ TEST_F(ReaderSeekTest, testSeekInProgress) { } TEST_P(ReaderSeekTest, testHasMessageAvailableAfterSeekToEnd) { - const auto topic = "test-has-message-available-after-seek-to-end-" + std::to_string(time(nullptr)); + const auto topic = "test-has-message-available-after-seek-to-end-" + std::to_string(time(nullptr)) + + std::to_string(GetParam()); Producer producer; ASSERT_EQ(ResultOk, client.createProducer(topic, producer)); Reader reader; @@ -980,7 +981,8 @@ TEST_F(ReaderSeekTest, testSeekInclusiveChunkMessage) { } TEST_P(ReaderSeekTest, testSeekToEndByTimestamp) { - auto topic = "test-seek-to-end-by-timestamp-" + std::to_string(time(nullptr)); + auto topic = + "test-seek-to-end-by-timestamp-" + std::to_string(time(nullptr)) + std::to_string(GetParam()); Producer producer; ASSERT_EQ(ResultOk, client.createProducer(topic, producer));