test: add GeneratorContext assertions for watch-mode generator-context builders (3930)#3935
Open
ash-thakur-rh wants to merge 3 commits into
Open
test: add GeneratorContext assertions for watch-mode generator-context builders (3930)#3935ash-thakur-rh wants to merge 3 commits into
ash-thakur-rh wants to merge 3 commits into
Conversation
…t builders (3930) Lock down the generator-context wiring refactored in eclipse-jkube#3928 with direct unit test assertions across all four plugin variants (Maven k8s/oc, Gradle k8s/oc). Maven: - WatchMojoTest: assert generatorMode==WATCH, prePackagePhase==false, runtimeMode, watchMode propagation, project, buildTimestamp, useProjectClasspath, sourceDirectory, filter - New OpenshiftWatchMojoTest: same assertions plus strategy==s2i and runtimeMode==OPENSHIFT Gradle: - KubernetesWatchTaskTest: assert generatorMode==WATCH, prePackagePhase==false, default and configured watchMode, runtimeMode==KUBERNETES - OpenShiftWatchTaskTest: same plus runtimeMode==OPENSHIFT and strategy==s2i CHANGELOG entry documents that Gradle k8sWatch/ocWatch now resolves generators in WATCH mode, activating Spring Boot DevTools wiring. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
Eclipse JKube CI ReportStarted new GH workflow run for #3935 (2026-07-08T13:57:46Z) ⚙️ JKube E2E Tests (28946852723)
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3935 +/- ##
=============================================
+ Coverage 59.36% 72.55% +13.19%
- Complexity 4586 4933 +347
=============================================
Files 500 496 -4
Lines 21211 19413 -1798
Branches 2830 2598 -232
=============================================
+ Hits 12591 14086 +1495
+ Misses 7370 4125 -3245
+ Partials 1250 1202 -48 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Maven: sourceDirectory/filter tests now set values and verify propagation instead of asserting null (which only tested absence of @parameter injection) - Gradle: add field parity with Maven tests (project, buildTimestamp, useProjectClasspath, sourceDirectory, filter) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add strategy assertion (JKubeBuildStrategy.docker) to KubernetesWatchTaskTest to match OpenShiftWatchTaskTest's s2i assertion and close strategy coverage gap - Add .isNotNull() guard to all GeneratorContext assertions across four test files for clearer diagnostics if the capture mechanism breaks - Convert getter-based assertions to .extracting() pattern for consistent null safety Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
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.



Summary
Resolves #3930 (acceptance criteria A + CHANGELOG part of B)
GeneratorContextassertions toWatchMojoTest(Maven Kubernetes) — locks downgeneratorMode==WATCH,prePackagePhase==false,runtimeMode,watchModepropagation,project,buildTimestamp,useProjectClasspath,sourceDirectory,filterOpenshiftWatchMojoTest(Maven OpenShift) — same assertions plusstrategy==s2iandruntimeMode==OPENSHIFTGeneratorContextassertions toKubernetesWatchTaskTest(Gradle Kubernetes) —generatorMode==WATCH,prePackagePhase==false, default/configuredwatchMode,runtimeMode==KUBERNETES,project,buildTimestamp,useProjectClasspath,sourceDirectory,filterGeneratorContextassertions toOpenShiftWatchTaskTest(Gradle OpenShift) — same plusruntimeMode==OPENSHIFTandstrategy==s2ik8sWatch/ocWatchnow resolving generators in WATCH mode (Spring Boot DevTools activation)Approach
Uses a test-subclass capture pattern: each test overrides
generatorContextBuilder()(Maven) orinitGeneratorContextBuilder()(Gradle) to callsuper, capture the builtGeneratorContextviabuilder.build(), and return the original builder so the production code path continues unmodified. Lombok builders support multiplebuild()calls safely.Maven
sourceDirectoryandfiltertests set explicit values and verify propagation (rather than asserting null from missing@Parameterinjection). Gradle tests now have full field parity with Maven tests.Out of scope (follow-up issues filed)
Test plan
WatchMojoTest— 12 tests pass (9 new)OpenshiftWatchMojoTest— 11 tests pass (all new)KubernetesWatchTaskTest— 13 tests pass (10 new)OpenShiftWatchTaskTest— 14 tests pass (11 new)