pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[fix][test]fix flaky test deleteNamespaceGracefully

Open poorbarcode opened this issue 3 years ago • 0 comments

Fixes #18232

Motivation

https://github.com/poorbarcode/pulsar/actions/runs/3267034877/jobs/5371836130 https://github.com/apache/pulsar/actions/runs/3242148385/jobs/5326408439

The original implementation determines whether to wait for the creation of __chang_event based on whether a broker has taken ownership of the bundle or not. However, there are often 'set namespace policy', 'unload namespace', 'delete namespace', 'split bundle', and other operations in the test case. When the bundle unload and the 'bundle checkconcurrently execute, the methoddeleteNamespaceGraceFully` will run unstably.

Modifications

  • Instead of relying on 'bundle owned' to determine whether to wait for the creation of topic __change_event, change to track the creation of all system topic clients (readers & writers) and wait for all clients(readers & writers) to be created finished before deleting the namespace
  • Originally, deleteNamespaceGraceFully in class BrokerTestBase, and then MockedPulsarServiceBaseTest called BrokerTestBase.deleteNamespaceGraceFully(). But MockedPulsarServiceBaseTest is the super class of BrokerTestBase, so move method deleteNamespaceGraceFully to MockedPulsarServiceBaseTest.

Documentation

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

Matching PR in forked repository

PR in forked repository:

  • https://github.com/poorbarcode/pulsar/pull/31

poorbarcode avatar Oct 27 '22 09:10 poorbarcode