Skip to content

test: isolate MQTT repository fixtures - #8089

Closed
yuluo-yx wants to merge 2 commits into
apache:masterfrom
yuluo-yx:fix/pr-8087-mqtt-test-fixtures
Closed

yuluo-yx wants to merge 2 commits into
apache:masterfrom
yuluo-yx:fix/pr-8087-mqtt-test-fixtures

Conversation

@yuluo-yx

Copy link
Copy Markdown
Member

Summary

  • isolate MQTT repository fixtures in SubscribeTest
  • initialize the inflight repository required by MqttTransportHandlerTest
  • prevent test-order-dependent NullPointerException failures in CI

Validation

  • ./mvnw test -pl shenyu-protocol/shenyu-protocol-mqtt -Drat.skip=true -Djacoco.skip=true
    • 140 tests passed
  • ./mvnw test -pl shenyu-common -DskipITs
    • 618 tests passed, 5 skipped
  • PR command tests: 11 passed
  • git diff --check passed

@yuluo-yx
yuluo-yx force-pushed the fix/pr-8087-mqtt-test-fixtures branch from 4ecded4 to 492c0b8 Compare October 24, 2026 10:08
Aias00
Aias00 previously approved these changes Oct 24, 2026
yuluo-yx pushed a commit that referenced this pull request Oct 24, 2026
…ion update (#8093)

SubscribeTest mocked ChannelRepository and SessionRepository, and a mock
answers null for every lookup. subscribe() therefore always took the
"no session" branch: the client id was null, the session was null, and the
code that stores the granted subscriptions on the session never ran. The
three assertions only covered SUBACK, so a regression there would have gone
unnoticed.

The channel and session repositories are now real instances, the connected
channel is registered in the channel repository, and a fourth test asserts
that the subscriptions land on the session. SubscribeRepository and
TopicRepository stay mocked, because subscribe() writes to the first and the
second is only observed through verify().

This also supersedes #8089, which adds the same real instances but keeps the
@mock fields with the same names and does not compile.

Co-authored-by: cloudbase-ai <[email protected]>
@yuluo-yx yuluo-yx closed this Oct 24, 2026
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.

2 participants