I'm attempting to run the pulsar unit tests locall...
# dev
c
I'm attempting to run the pulsar unit tests locally to work on a potential unit test to cover the race conditions I found. I'm running:
./gradlew :pulsar-broker:test --tests "org.apache.pulsar.broker.service.persistent.PersistentDispatcherMultipleConsumersTest.testTopicDeleteIfConsumerSetMismatchConsumerList"
without any changes and it is failing with:
Copy code
Gradle suite > Gradle test > org.apache.pulsar.broker.service.persistent.PersistentDispatcherMultipleConsumersTest > testTopicDeleteIfConsumerSetMismatchConsumerList FAILED
    org.testng.internal.thread.ThreadTimeoutException: Method org.apache.pulsar.broker.service.persistent.PersistentDispatcherMultipleConsumersTest.testTopicDeleteIfConsumerSetMismatchConsumerList() didn't finish within the time-out 30000
        at java.base@21.0.11/jdk.internal.misc.Unsafe.park(Native Method)
I assume we need a local pulsar cluster to run tests tests against? I have docker running locally (but nothing stood up). tests/README.md talks about tests using Test Containers, but I'm not sure if that is for the integration tests only. I don't see any instructions on https://pulsar.apache.org/contribute/setup-building/ that covers a docker-compose I need to stand up to run unit tests? I see a number of potential options?
✅ 1
I see https://pulsar.apache.org/contribute/personal-ci/ to run all tests before PR but nothing for local dev
Copy code
$ pwd
/Users/donblas/Programming/Projects/pulsar/tests/compose/simple
docker compose up -d
WARN[0000] /Users/donblas/Programming/Projects/pulsar/tests/compose/simple/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Running 6/6
 ✘ bk2 Error     context canceled                                                                                                                                                                                                          0.8s
 ✘ pulsar1 Error context canceled                                                                                                                                                                                                          0.8s
 ✘ zk Error      context canceled                                                                                                                                                                                                          0.8s
 ✘ init Error    pull access denied for apachepulsar/pulsar-test-latest-version, repository does not exist or may require 'docker login': denied: requested access to the resource is denied                                               0.8s
 ✘ bk1 Error     context canceled                                                                                                                                                                                                          0.8s
 ✘ bk3 Error     context canceled
l
Docker is a requirement only for tests/integration-tests and a few other tests in the code base where Testcontainers is used.
c
Ok, any idea why I'm seeing failures like the one posted above or:
Copy code
testRaceTrackDelayedDelivery FAILED
    org.apache.pulsar.client.admin.PulsarAdminException$ServerSideErrorException:
     --- An unexpected error occurred in the server ---

    Message: {"errorMsg":"org.apache.bookkeeper.mledger.ManagedLedgerException: Not enough non-faulty bookies available error code: -6","reqId":1296992488924910610, "remote":"localhost/127.0.0.1:59564", "local":"/127.0.0.1:59567"}

    Stacktrace:

    org.apache.pulsar.client.api.PulsarClientException$BrokerPersistenceException: {"errorMsg":"org.apache.bookkeeper.mledger.ManagedLedgerException: Not enough non-faulty bookies available error code: -6","reqId":1296992488924910610, "remote":"localhost/127.0.0.1:59564", "local":"/127.0.0.1:59567"}
        at org.apache.pulsar.client.impl.ClientCnx.getPulsarClientException(ClientCnx.java:1612)
l
one reason for the "Not enough non-faulty bookies available" error is that there isn't more than 95% of available disk space. That's a BookKeeper default setting. It might also be another issue.
which type of dev environment do you have? For master branch, Java 21 or Java 25 is recommended. In CI, we use Amazon Corretto OpenJDK distribution. I also use that for local development.
Copy code
❯ java -version
openjdk version "21.0.11" 2026-04-21 LTS
OpenJDK Runtime Environment Corretto-21.0.11.10.1 (build 21.0.11+10-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.11.10.1 (build 21.0.11+10-LTS, mixed mode, sharing)
When running Personal CI, you might run into flaky tests. When that happens, you can rerun failed jobs after the workflow run completes. For a apache/pulsar PR, adding a comment
/pulsarbot rerun
will trigger a rerun if CI happens to fail due to a flaky test. The benefit of Personal CI is that you have full control of running the CI pipeline. For apache/pulsar PRs, a maintainer has to approve each run after a change.
regarding the
apachepulsar/pulsar-test-latest-version
image, that is required by integration tests. The image is built separately. There are instructions in https://github.com/apache/pulsar/blob/master/tests/README.md
c
Copy code
$ java -version
openjdk version "21.0.11" 2026-04-21 LTS
OpenJDK Runtime Environment Corretto-21.0.11.10.1 (build 21.0.11+10-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.11.10.1 (build 21.0.11+10-LTS, mixed mode, sharing)
I followed https://pulsar.apache.org/contribute/setup-buildtools/ and installed SDKMAN and then the latest 21
👍 1
Ok, that was it - I just cleaned up a bunch of docker images and now the tests pass
👍 1
Thanks!
l
thanks for reporting the issue, I created an improvement PR https://github.com/apache/pulsar/pull/25677 so that others don't hit the same problem. I've also hit it in the past. 🙂
👍 1