Skip to content

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

@alejandroGM0

Description

@alejandroGM0

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

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions