hiero-ledger / hiero-ledger/hiero-enterprise-java

test(microprofile): replace fixed sleeps with mirror-node polling in integration tests

Open
#180 5 comments 0 reactions 0 assignees View on GitHub
enhancement pending-review
Dominant language
Java
Stars
6
Forks
21
Avg merge
10h 27m
Merged PRs (30d)
37

Description

## Problem

Several MicroProfile integration tests use a hard-coded `Thread.sleep(10_000)` before
querying the mirror node:

- `AccountRepositoryTest` – 1 occurrence
- `TokenRepositoryTest` – 6 occurrences
- `TopicRepositoryTest` – 4 occurrences

Each call has a `// TODO: fix sleep` comment acknowledging the issue. Fixed sleeps have
two drawbacks:

1. **Slow** – always waits the full 10 s even when the mirror node has already indexed the
record.
2. **Flaky** – may still time out when the mirror node is under load or the network is slow.

The Spring integration tests already use `HieroTestUtils.waitForMirrorNodeRecords()`,
which polls until the last submitted transaction appears in the mirror node (or times out),
making them faster on a healthy network and more reliable under load.

## Expected behaviour

All MicroProfile integration tests replace `Thread.sleep(10_000)` with
`hieroTestUtils.waitForMirrorNodeRecords()`, consistent with the Spring test suite.

## Scope

- `hiero-enterprise-microprofile/.../AccountRepositoryTest.java`
- `hiero-enterprise-microprofile/.../TokenRepositoryTest.java`
- `hiero-enterprise-microprofile/.../TopicRepositoryTest.java`

Contributor guide

Open the contributing guide

Research direction

Start by inspecting AccountRepositoryTest.java, TokenRepositoryTest.java, and TopicRepositoryTest.java in the MicroProfile integration-test module, then compare the Spring integration tests' use of HieroTestUtils.waitForMirrorNodeRecords(). Replace the listed fixed sleeps with the polling utility and run the relevant MicroProfile integration tests; done means all 11 occurrences use polling instead of Thread.sleep(10_000).

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.