pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[fix][test] Fix flaky PersistentTopicsTest setup caused by concurrent Mockito stubbing

Open void-ptr974 opened this issue 5 months ago • 0 comments

Motivation

Fixes #26076.

PersistentTopicsTest.setup can fail with Mockito AssertionError or UnfinishedStubbingException because the test updates stubs on the PulsarService spy after the broker has started, while background broker threads may call the same mock.

Modifications

  • Replace runtime stubbing of pulsar.getPulsarResources() with a configured PulsarResources spy installed on the service field.
  • Route per-test namespace and topic resource overrides through volatile handlers instead of re-stubbing the live PulsarService spy.

Documentation

  • [ ] doc
  • [ ] doc-required
  • [x] doc-not-needed
  • [ ] doc-complete

Verifications

  • ./gradlew :pulsar-broker:test --tests org.apache.pulsar.broker.admin.PersistentTopicsTest
  • ./gradlew :pulsar-broker:checkstyleTest

void-ptr974 avatar Jun 24 '26 16:06 void-ptr974