Praveenkumar76 opened a new pull request, #25590:
URL: https://github.com/apache/pulsar/pull/25590

   Fixes [apache#25391](https://github.com/apache/pulsar/issues/25391)
   
   ### Motivation
   
   `PulsarFunctionsJavaThreadTest.testTumblingCountWindowTest` fails 
intermittently in CI with assertion errors such as:
   
   ```
   expected [1] but found [3]
   ```
   
   The failure is caused by race conditions in the test. It validates 
TopicStats and SubscriptionStats immediately after producing messages, while 
broker statistics are updated asynchronously. As a result, the test may read 
stale or partially updated values.
   
   Additionally, some assertions use inverted parameter ordering, which makes 
failure messages harder to interpret.
   
   ### Modifications
   
   - Replaced immediate metric assertions with 
Awaitility.await().untilAsserted(...) so the test waits until broker stats 
reach the expected values.
   - Applied asynchronous waiting for both backlog verification and final 
acknowledgment / cleanup checks.
   - Corrected assertEquals argument ordering to improve assertion readability 
and failure diagnostics.
   - Improved test stability by aligning assertions with the eventual 
consistency behavior of broker metrics.
   
   ### Verifying this change
   
   This change is a bug fix and was verified manually:
   
   - Re-ran PulsarFunctionsJavaThreadTest.testTumblingCountWindowTest multiple 
times locally without intermittent failures.
   - Confirmed the test now waits for expected metrics before asserting.
   - Executed the targeted Gradle integration test successfully:
   ``` 
   ./gradlew :tests:integration:test --tests 
"*PulsarFunctionsJavaThreadTest.testTumblingCountWindowTest"
   
   Starting a Gradle Daemon (subsequent builds will be faster)
   Configuration on demand is an incubating feature.
   Reusing configuration cache.
   
   BUILD SUCCESSFUL in 2s
   98 actionable tasks: 5 executed, 1 from cache, 92 up-to-date
   ```
   - CI validation pending / to be confirmed after PR run.
   
   
   ### Does this pull request potentially affect one of the following parts:
   
   - [ ] 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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to