Skip to content

Fix flaky tests MqttClientActorTest#testConnectionIsSuccessful and PubSubFactoryTest#failAckDeclarationDueToRemoteConflict#2342

Merged
thjaeckle merged 2 commits into
eclipse-ditto:masterfrom
beyonnex-io:bugfix/fix-flaky-mqtt-test-connection-successful
Feb 17, 2026
Merged

Fix flaky tests MqttClientActorTest#testConnectionIsSuccessful and PubSubFactoryTest#failAckDeclarationDueToRemoteConflict#2342
thjaeckle merged 2 commits into
eclipse-ditto:masterfrom
beyonnex-io:bugfix/fix-flaky-mqtt-test-connection-successful

Conversation

@thjaeckle
Copy link
Copy Markdown
Member

Disconnect the MQTT client before sending the reply in ConnectionTesterActor.testConnection(). Previously, the reply triggered an inline callback chain (via CallingThreadDispatcher) that terminated the actor before disconnectMqttClient() executed, causing the test's verify(genericMqttClient).disconnect() to fail intermittently.

Also remove the redundant first verify call in the test — the single verify after expectTerminated is sufficient.

Disconnect the MQTT client before sending the reply in
ConnectionTesterActor.testConnection(). Previously, the reply
triggered an inline callback chain (via CallingThreadDispatcher)
that terminated the actor before disconnectMqttClient() executed,
causing the test's verify(genericMqttClient).disconnect() to fail
intermittently.

Also remove the redundant first verify call in the test — the
single verify after expectTerminated is sufficient.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@thjaeckle thjaeckle added this to the 3.9.0 milestone Feb 17, 2026
The test waited for heartbeats on system2 (the writer) but did not
ensure the DData had actually been replicated to system1 (the reader).
Replace waitForHeartBeats(system2) with a new waitForRemoteAcks helper
that deterministically waits for system1 to receive a RemoteAcksChanged
event containing the expected ack label before asserting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@thjaeckle thjaeckle changed the title Fix flaky MqttClientActorTest#testConnectionIsSuccessful Fix flaky tests MqttClientActorTest#testConnectionIsSuccessful and PubSubFactoryTest#failAckDeclarationDueToRemoteConflict Feb 17, 2026
@thjaeckle thjaeckle self-assigned this Feb 17, 2026
@thjaeckle thjaeckle merged commit 0360edc into eclipse-ditto:master Feb 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant