Skip to content

Commit 9ce8bf6

Browse files
fix up
Signed-off-by: Ndacyayisenga-droid <[email protected]>
1 parent 9e20dad commit 9ce8bf6

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

hiero-enterprise-spring/src/test/java/com/openelements/hiero/spring/test/TopicRepositoryTest.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,24 @@ void testNullParam() {
3535
}
3636

3737
@Test
38-
void testFindTopicById() throws HieroException {
38+
void testFindTopicById() throws HieroException, InterruptedException {
3939
final TopicId topicId = topicClient.createTopic();
40-
topicClient.submitMessage(topicId, "topic test visibility");
41-
hieroTestUtils.waitForMirrorNodeRecords(); // Wait until the topic appears on mirror node via message
40+
topicClient.submitMessage(topicId, "trigger-indexing");
41+
hieroTestUtils.waitForMirrorNodeRecords();
4242

43-
final Optional<Topic> result = topicRepository.findTopicById(topicId);
43+
Optional<Topic> result = Optional.empty();
44+
long timeoutMillis = 10000;
45+
long startTime = System.currentTimeMillis();
4446

45-
Assertions.assertNotNull(result);
47+
while (System.currentTimeMillis() - startTime < timeoutMillis) {
48+
result = topicRepository.findTopicById(topicId);
49+
if (result.isPresent()) {
50+
break;
51+
}
52+
Thread.sleep(500);
53+
}
54+
55+
Assertions.assertNotNull(result, "Expected non-null Optional from topicRepository.");
4656
Assertions.assertTrue(result.isPresent(), "Expected topic to be present, but it was not found.");
4757
}
4858

0 commit comments

Comments
 (0)