Skip to content

Isolate Kubernetes plugin test working directories under target/#22301

Merged
gnodet merged 1 commit intoapache:mainfrom
gnodet:jbang-kubernetes-test-cleanup
Mar 29, 2026
Merged

Isolate Kubernetes plugin test working directories under target/#22301
gnodet merged 1 commit intoapache:mainfrom
gnodet:jbang-kubernetes-test-cleanup

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented Mar 27, 2026

Summary

Kubernetes plugin tests (KubernetesRunTest, KubernetesRunCustomTest) create
.camel-jbang-run/<project>/ directories in the module root via KubernetesRun.doCall().
These directories are never cleaned up, which causes two problems:

  1. Concurrent test collisions: both test classes write to the same project directories
    (e.g. .camel-jbang-run/route/, .camel-jbang-run/my-route-props/), so they cannot
    run in parallel.
  2. Stale files in the source tree: leftover directories can cause ENOENT race conditions
    when docs gulp scans the source tree with ** globs.

Changes

  • Extract a getRunPlatformDir() method in KubernetesRun (default: .camel-jbang-run)
    that tests override to target/tests/<ClassName> via anonymous subclass. This isolates
    each test class into its own directory under target/, which is gitignored and cleaned
    by mvn clean.
  • Add @AfterAll/@AfterEach cleanup in the test classes to remove the per-class directory.
  • Add missing CommandLineHelper.useHomeDir("target") to KubernetesRunCustomTest to
    prevent .camel-jbang/ leaking into the source tree.

Test plan

  • mvn test -B -pl dsl/camel-jbang/camel-jbang-plugin-kubernetes — all 128 tests pass
  • No leftover .camel-jbang-run/ directories after test run
  • Formatting clean (mvn formatter:format impsort:sort)

@gnodet gnodet requested a review from christophd March 27, 2026 20:08
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions github-actions bot added the dsl label Mar 27, 2026
@gnodet gnodet force-pushed the jbang-kubernetes-test-cleanup branch from 7b43dfd to f0cd6d2 Compare March 27, 2026 20:54
@gnodet gnodet changed the title Clean up .camel-jbang-run directories after Kubernetes plugin tests Isolate Kubernetes plugin test working directories under target/ Mar 27, 2026
@gnodet gnodet force-pushed the jbang-kubernetes-test-cleanup branch 3 times, most recently from a462f00 to 7557751 Compare March 27, 2026 21:35
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet force-pushed the jbang-kubernetes-test-cleanup branch from 7557751 to c266711 Compare March 27, 2026 21:52
@gnodet gnodet requested a review from cunningt March 28, 2026 05:54
@gnodet gnodet merged commit a4d17dd into apache:main Mar 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants