This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 08214bfd61a0 CAMEL-27440: camel-kubernetes - Fix flaky
KubernetesClusterViewStopTest (#30657)
08214bfd61a0 is described below
commit 08214bfd61a0aaf4053c2c042381871a3c2c6261
Author: Aurélien Pupier <[email protected]>
AuthorDate: Mon Nov 23 13:13:36 2026 +0100
CAMEL-27440: camel-kubernetes - Fix flaky KubernetesClusterViewStopTest
(#30657)
testStoppedViewReleasesLeadership asserted that the lease is empty after
the leader released it, but the other pod can take the lease before the
assertion runs, so assert that the lease no longer names the stopped pod
instead.
testStopOfManyGroupsDoesNotWaitWhenTheLastLookupFailed limited the stop of
3 groups to half the renew deadline, which is too tight on a loaded CI machine.
A release that is tried waits until the renew deadline, so use the renew
deadline as the limit.
Co-authored-by: IBM Bob 2.2.1
Signed-off-by: Aurélien Pupier <[email protected]>
---
.../kubernetes/cluster/KubernetesClusterViewStopTest.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git
a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cluster/KubernetesClusterViewStopTest.java
b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cluster/KubernetesClusterViewStopTest.java
index 3cfdca807e54..2993436ae5ef 100644
---
a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cluster/KubernetesClusterViewStopTest.java
+++
b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cluster/KubernetesClusterViewStopTest.java
@@ -44,6 +44,7 @@ import org.junit.jupiter.params.provider.EnumSource;
import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -95,8 +96,9 @@ class KubernetesClusterViewStopTest extends CamelTestSupport {
assertTrue(view.getLeader().isEmpty());
assertFalse(services.get(leader).isLeader(NS));
assertNull(recorders.get(leader).getCurrentLeader());
- // the lease no longer names the pod (which is still ready), so the
other pod takes over
- assertNull(getHolder());
+ // the lease no longer names the pod (which is still ready), so the
other pod takes over (the other pod may
+ // have taken the lease already, so the lease is not expected to be
empty here)
+ assertNotEquals(leader, getHolder());
recorders.get(other).waitForLeader(other::equals, 3L *
LEASE_TIME_MILLIS, TimeUnit.MILLISECONDS);
assertTrue(services.get(other).isLeader(NS));
assertEquals(other, getHolder());
@@ -214,7 +216,8 @@ class KubernetesClusterViewStopTest extends
CamelTestSupport {
service.stop();
long millis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
- assertTrue(millis < RENEW_DEADLINE_MILLIS / 2, "The stop of " +
GROUPS.size() + " groups took " + millis + " ms");
+ // a release that is tried waits until the renew deadline, so the stop
would take at least that long
+ assertTrue(millis < RENEW_DEADLINE_MILLIS, "The stop of " +
GROUPS.size() + " groups took " + millis + " ms");
for (String group : GROUPS) {
assertTrue(service.getView(group).isStopped());
assertEquals("mypod1", getHolder(type, simulators, group));