Skip to content

[improve][testing] Add client/admin builders and temporary directory support for testing standalone service - #26807

Open
hohoho1886 wants to merge 12 commits into
apache:masterfrom
hohoho1886:pulsarStandalone-API
Open

hohoho1886 wants to merge 12 commits into
apache:masterfrom
hohoho1886:pulsarStandalone-API

Conversation

@hohoho1886

@hohoho1886 hohoho1886 commented Oct 1, 2026 •

Copy link
Copy Markdown

Fixes #10473

Motivation

This PR aims to make testing with PulsarStandalone more convenient because:

  • In PulsarStandaloneBuilder, there are no helper methods to create a PulsarClient or PulsarAdmin connected to the started service.
  • When testing, messages are written to disk and test data persist there even when the service is stopped.

Modifications

  • Add buildClient() and buildAdmin() methods
  • Implement a method which creates temporary directories, then delete them in close() (which should be called at the end of the test) of PulsarStandalone
  • Adapt startBookieWithMetadataStore() to start the service without .conf file. I think this is safe in production because else branch is never executed as long as .conf file is provided (which is the case in production)

Otherwise, I am ready to address any requested changes.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change added tests and can be verified as follows:

  • Added PulsarStandaloneBuilderTest.testStartFromJava, which starts a
    standalone service from plain Java with a client and check if temporary directory is deleted after the service is closed.
  • Note: I set standalone.setNumOfBk(2) to avoid the error of not having enough healthy bookies.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

@hohoho1886 hohoho1886 changed the title Pulsar standalone api [improve][testing] Add client/admin builders and temporary directory support for testing Oct 1, 2026
@hohoho1886 hohoho1886 changed the title [improve][testing] Add client/admin builders and temporary directory support for testing [improve][testing] Add client/admin builders and temporary directory support for testing standalone service Oct 1, 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.

PulsarStandaloneBuilder: make it a public API

1 participant