Claus Ibsen created CAMEL-27562:
-----------------------------------

             Summary: camel-jbang-kubernetes - tests: no fixed 2 s retry waits, 
no timing assertion, no shared home directory
                 Key: CAMEL-27562
                 URL: https://issues.apache.org/jira/browse/CAMEL-27562
             Project: Camel
          Issue Type: Test
          Components: camel-jbang
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.24.0


Follow-up of CAMEL-21278, whose test refactoring was left.

The tests of camel-jbang-plugin-kubernetes take about 205 s locally (on CI most 
of them are disabled by ci.env.name). Most of the time is the tests that run 
Maven and JKube for camel kubernetes run (about 5 s each); that is what they 
test. The rest is avoidable, and some of it breaks the test rules of AGENTS.md:

* KubernetesPodLogsTest.shouldGetPodLogs takes 20 s: KubernetesPodLogs waits a 
fixed 2 s between retries (Thread.sleep), and the mock server answers the log 
request with one line, so the command retries 10 times until maxMessageCount. 
shouldHandlePodNotFound waits 2 s the same way. The test asserts only the exit 
code.
* KubernetesPodLogsTest.theLogOfAFinishedPodIsReadOnce asserts that the call 
takes less than 2 s, which a loaded CI machine does not guarantee.
* KubernetesBaseTestSupport sets the home of the CLI to the fixed directory 
target in @BeforeAll and never sets it back, so all test classes (and any other 
test of the fork) share it.

Fix: a retry delay that the tests can shorten, assertions on what the command 
printed instead of on the time it took, and a home directory of its own for 
each test class, set back after the class.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to