Repository navigation
Conversation
MavenResolverRegisteredBeforeConfigAdminTest asserted exactly 5 MavenResolver service events. pax-url-aether registers a resolver when it starts, then re-registers it on every ManagedService.updated() call from ConfigAdmin, so 5 events means two calls: updated(null), then the etc/org.ops4j.pax.url.mvn.cfg configuration. When FileInstall creates that configuration before ConfigAdmin first calls updated(), there is only one call and 3 events, which fails on the macOS CI runners. Wait until a single MavenResolver built from the ConfigAdmin configuration is left registered, then check that the first registration was made from the bundle context, i.e. before ConfigAdmin. The "only after" test waits the same way before checking for a single registration. Failure messages now list the events. ServiceMonitor is filled by the registering threads while the probe reads it, so use a CopyOnWriteArrayList instead of a LinkedList.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since #3116 re-enabled them,
MavenResolverRegisteredBeforeConfigAdminTest.mavenResolverAvailablefails ontest (macos-latest)with:It fails on
main(run 44907370033, f0541e5) and on all 3 attempts of #3143 (run 44903955446). The other OS jobs pass.Cause
The test counts
org.ops4j.pax.url.mvn.MavenResolverservice events. pax-url-aether registers a resolver when it starts (service propertyconfiguration=bundlecontext). EachManagedService.updated()call from ConfigAdmin then registers a new resolver and unregisters the old one, which is 2 events:updated(null)(anotherbundlecontextresolver), then delivers theetc/org.ops4j.pax.url.mvn.cfgconfiguration (configadminresolver).updated(), so there is one call only.Both are valid startups. Which one happens depends on the timing between FileInstall and ConfigAdmin's update thread. The 3-event case reproduces locally by starting pax-url-aether after FileInstall and ConfigAdmin (start level 12 in
etc/startup.properties):[REGISTERED(bundlecontext), REGISTERED(configadmin), UNREGISTERING(bundlecontext)].Fix
KarafMinimalMonitoredTestSupport.awaitFinalRegistrationwaits (up to 30 s) until a single MavenResolver is left registered and it was built from the ConfigAdmin configuration. The registrations happen on ConfigAdmin's thread, so the probe can also run before the last one.MavenResolverRegisteredBeforeConfigAdminTestthen checks that the first registration was made from the bundle context, i.e. before ConfigAdmin, which is what the test is about, instead of an exact count.MavenResolverRegisteredOnlyAfterConfigAdminTestwaits the same way, then still requires exactly one registration. Its Javadoc, copied from the other test, is corrected.[REGISTERED(bundlecontext), REGISTERED(configadmin), UNREGISTERING(bundlecontext)], as CI doesn't upload the container logs.ServiceMonitoris filled by the registering threads while the probe reads it, so it now uses aCopyOnWriteArrayListinstead of aLinkedList.Testing
Against a build of
mainon macOS arm64, JDK 21:Both tests are still
@Ignored onkaraf-4.4.x, so no backport is needed.