Skip to content

[fix][test] Fix flaky AdminApiTest.partitionedTopicsCursorReset#25847

Merged
nodece merged 1 commit into
apache:masterfrom
lhotari:lh-fix-admin-api-cursor-reset-flake
May 21, 2026
Merged

[fix][test] Fix flaky AdminApiTest.partitionedTopicsCursorReset#25847
nodece merged 1 commit into
apache:masterfrom
lhotari:lh-fix-admin-api-cursor-reset-flake

Conversation

@lhotari
Copy link
Copy Markdown
Member

@lhotari lhotari commented May 20, 2026

Motivation

AdminApiTest.partitionedTopicsCursorReset is flaky in CI. Recent example: PR #25844 run 26175306430 job 77005757000.

Gradle suite > Gradle test > org.apache.pulsar.broker.admin.AdminApiTest > partitionedTopicsCursorReset[2](topic_+&*%{}() \$@#^%) FAILED
    org.apache.pulsar.client.admin.PulsarAdminException$PreconditionFailedException: Subscription has active connected consumers
        at org.apache.pulsar.broker.admin.AdminApiTest.partitionedTopicsCursorReset(AdminApiTest.java:3104)

        Caused by:
        javax.ws.rs.ClientErrorException: HTTP 412 {"reason":"Subscription has active connected consumers"}

consumer.close() returns once the close request has been dispatched to the broker, but the broker may not yet have processed the disconnect when the test immediately calls admin.topics().deleteSubscription(...). The broker's precondition check still sees a connected consumer and returns HTTP 412.

Modifications

Wrap the deleteSubscription call in Awaitility.await().ignoreExceptionsInstanceOf(PreconditionFailedException.class).untilAsserted(...) so the test retries the delete until the broker has detected the consumer disconnect.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as the modified partitionedTopicsCursorReset test itself.

After consumer.close() returns, the broker may not yet have processed
the consumer-disconnect when deleteSubscription is called, causing the
precondition check to fail with HTTP 412 "Subscription has active
connected consumers". Retry the delete via Awaitility, ignoring
PreconditionFailedException, until the broker has detected the
disconnect.
@nodece nodece merged commit 8d2c2e4 into apache:master May 21, 2026
43 checks passed
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