jbonofre opened a new pull request, #2971:
URL: https://github.com/apache/karaf/pull/2971

   `ConfigExampleTest.testManaged` fails intermittently on CI, for example on 
#2968 (a GitHub Actions bump that does not touch any Karaf code):
   
   ```
   ConfigExampleTest.testManaged:75->KarafTestSupport.assertContains:748 Should 
contain 'Configuration changed' but was :
   ```
   
   The test asserts on the captured `System.out` right after installing the 
`karaf-config-example-managed` feature. The expected line is printed by the 
example's `ManagedService`, which ConfigurationAdmin calls on its own thread, 
so the assertion can run before the callback does.
   
   This change adds an `awaitOutput(...)` helper that polls the captured output 
with Awaitility (up to 30 seconds) and uses it:
   
   - in `testManaged`, for both assertions
   - in `testListener`, `testBlueprint`, `testScr` and `testScrJson`, in place 
of the `Thread.sleep(500)` followed by an assertion, which has the same race
   
   `testStatic` is unchanged, as that example prints synchronously from its 
activator.
   
   Tested locally with `mvn -Ptest -f itests/test/pom.xml test 
-Dtest=ConfigExampleTest` on JDK 17: 6 tests run, 0 failures.


-- 
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