refactor(operator): convert test lifecycle to @TestInstance(PER_CLASS)#8452
Draft
paoloantinori wants to merge 1 commit into
Draft
refactor(operator): convert test lifecycle to @TestInstance(PER_CLASS)#8452paoloantinori wants to merge 1 commit into
paoloantinori wants to merge 1 commit into
Conversation
Convert operator integration tests from static to instance-based lifecycle using JUnit 5 PER_CLASS. This eliminates shared static state (client, namespace, app) that prevents parallel module execution. Changes: - ITBase and OLMITBase: add @testinstance(PER_CLASS), convert static fields to instance fields, convert @BeforeAll/@afterall to instance methods - Pure utility methods (calculateNamespace, createK8sClient, etc.) remain static since they don't access instance state - 10 subclasses updated: static @BeforeAll → instance, method references ITBase:: → this:: This is a prerequisite for removing the -T1 override in the operator Makefile. Cross-module parallel execution also requires namespace-scoped operator watching (separate change). Signed-off-by: Paolo Antinori <pantinor@gmail.com>
|
Member
Author
|
Paolo's note: I leave you decide the tradeoff between clarity and future proof |
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
Convert operator integration test infrastructure from static to instance-based lifecycle using JUnit 5
@TestInstance(Lifecycle.PER_CLASS). This is a code quality improvement — not a fix for the-T 1CCI failure.What Changed
ITBaseandOLMITBase: add@TestInstance(PER_CLASS), convert 12 static fields to instance fields, convert lifecycle methods to instance methodscalculateNamespace,createK8sClient, etc.) remain static — they don't access instance statestatic @BeforeAll→ instance, method referencesITBase::→this::What This Does NOT Fix
The
-T 1CCI failure (issue #8447) is caused by resource exhaustion, not shared Java state. The Makefile runs-pl controller -am— only ONE module's tests execute. Theolm-testsmodule is not involved. Under-T 1C, 8 parallel Maven threads do Quarkus augmentation + compilation while Minikube pods are also running. The CPU/memory pressure causes pods to start slower, exceeding the 120s awaitility timeout.The correct fix for the CI failure is the
-T1override in the Makefile (PR #8448, already merged). This refactoring is complementary — it eliminates unnecessary static state as a code quality improvement and a prerequisite for future intra-module test parallelism (if ever needed).Value of This Change
Status
./mvnw install -f operator/pom.xml -DskipTests)AuthTLSITTest.init()was still static)Context
See the Known Issues FAQ in Discussion #8365 for the full analysis, including the corrected root cause (resource exhaustion, not shared memory state).