jvrubel opened a new pull request, #26864:
URL: https://github.com/apache/camel/pull/26864

     PR #26082 reverted #25948 because that PR introduced cleanups that relied 
on container-specific paths
     and execution semantics not available in bare-metal 
(local-camel-cli-process) mode, and used the
     non-obvious three-argument execute(command, getError, expectFail) overload 
for best-effort cleanup
     calls.
   
     This PR reimplements the cleanup work from #25948 with the issues 
addressed.
   
     Changes
   
     JBangTestSupport (base class, afterEach)
   
     Bug fix: the /home/jbang sweep's catch block was catch (Exception e), but 
execInContainer(...) throws
     AssertionFailedError (which extends AssertionError, not Exception) in 
local process mode because
     /home/jbang does not exist on the host. The error escaped the finally 
block, skipping
     FileUtil.removeDir, which left the working directory behind. Every 
subsequent test's beforeEach then
     failed with FileAlreadyExists on the shared singleton service directory. 
Fixed to catch (Exception | 
     AssertionError e).
   
     Config cleanup: after the file cleanup, four persistent CLI config keys 
(runtime, gav, directory,
     camel-version) are now unset unconditionally. Any test that calls camel 
config set leaks those values
     into later tests via the .camel-jbang/ hidden directory, which survives 
the /home/jbang sweep. This is
     done with execute(command) (no boolean arguments) wrapped in a try-catch.
   
     CamelDebugITCase — @Tag("container-only")
   
     testDebug calls execNohup("debug <container-path>") and attaches to a 
debugger JMX port that only
     exists inside the container. It cannot run in bare-metal mode.
   
     JolokiaITCase — @Tag("container-only") + @AfterEach stopJolokiaAndHawtio()
   
     The Jolokia agent and Hawtio process are started separately from the Camel 
route. camel stop shuts down
     the route but not Hawtio, which lingers across tests. Added a best-effort 
@AfterEach that stops both.
     The class also uses execInContainer("curl ..."), so it requires a 
container.
   
     ValidatePluginITCase — @AfterEach removeValidatePlugin()
   
     Both tests in this class install the validate plugin. Plugins are stored 
in .camel-jbang/ (hidden
     config), which is not touched by the /home/jbang sweep. The plugin 
therefore persists across test
     classes. Added a best-effort @AfterEach calling camel plugin delete 
validate.
   
     OpenApiITCase — @AfterEach cleanupOpenApiArtifacts()
   
     generateOpenApiWithDtoUsingContractFirstApproach installs the generate 
plugin. Same persistence issue
     as above. Added a best-effort @AfterEach calling camel plugin delete 
generate.
   
     RunCommandITCase — @AfterEach cleanupTmpDirs()
   
     runRoutesFromMultipleFilesUsingWildcardTest creates /tmp/one and /tmp/two 
directly on the host. These
     paths are outside the working directory that the base class sweeps. Added 
a best-effort @AfterEach that
     removes them.
   
     Testing
   
     Verified locally in dockerless mode 
(-Dcamel-cli.instance.type=local-camel-cli-process, profile
     jbang-it-test):
   
     Tests run: 87, Failures: 0, Errors: 0, Skipped: 5
   
     The 5 skips are the 2 container-only classes (CamelDebugITCase, 
JolokiaITCase) excluded via
     failsafe.excludedGroups=container-only, plus 2 Quarkus export tests and 2 
Spring Boot version-list
     tests that require runtime BOMs not available in the CI environment.
   


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