jbonofre opened a new pull request, #2972: URL: https://github.com/apache/karaf/pull/2972
Backport of #2971 to `karaf-4.4.x`. `ConfigExampleTest.testManaged` fails intermittently on CI: ``` 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. ## Backport notes - Clean cherry-pick: `ConfigExampleTest.java` was identical on `main` and `karaf-4.4.x` before the change. - `karaf-4.4.x` uses Awaitility 3.1.6 (`main` uses 4.3.0). The calls used here (`await().atMost(long, TimeUnit).untilAsserted(...)`) are available in both, so no adaptation was needed. Tested locally on this branch with `mvn -Ptest -f itests/test/pom.xml test -Dtest=ConfigExampleTest` on JDK 11: 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]
