From 025197111684486aca8e52c1444d09412f4f29d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Attila=20M=C3=A9sz=C3=A1ros?= <a_meszaros@apple.com>
Date: Mon, 6 Jan 2025 12:36:08 +0100
Subject: [PATCH] fix: leader election e2e test (#2655)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
---
 .../io/javaoperatorsdk/operator/sample/LeaderElectionE2E.java   | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sample-operators/leader-election/src/test/java/io/javaoperatorsdk/operator/sample/LeaderElectionE2E.java b/sample-operators/leader-election/src/test/java/io/javaoperatorsdk/operator/sample/LeaderElectionE2E.java
index 863407999d..dd6f4bc244 100644
--- a/sample-operators/leader-election/src/test/java/io/javaoperatorsdk/operator/sample/LeaderElectionE2E.java
+++ b/sample-operators/leader-election/src/test/java/io/javaoperatorsdk/operator/sample/LeaderElectionE2E.java
@@ -138,6 +138,7 @@ private void deployOperatorsInOrder(String yamlFilePrefix) {
     applyResources("k8s/" + yamlFilePrefix + "operator.yaml");
     await().atMost(Duration.ofSeconds(POD_STARTUP_TIMEOUT)).untilAsserted(() -> {
       var pod = client.pods().inNamespace(namespace).withName(OPERATOR_1_POD_NAME).get();
+      assertThat(pod.getStatus().getContainerStatuses()).isNotEmpty();
       assertThat(pod.getStatus().getContainerStatuses().get(0).getReady()).isTrue();
     });
 
@@ -145,6 +146,7 @@ private void deployOperatorsInOrder(String yamlFilePrefix) {
     applyResources("k8s/" + yamlFilePrefix + "operator-instance-2.yaml");
     await().atMost(Duration.ofSeconds(POD_STARTUP_TIMEOUT)).untilAsserted(() -> {
       var pod = client.pods().inNamespace(namespace).withName(OPERATOR_2_POD_NAME).get();
+      assertThat(pod.getStatus().getContainerStatuses()).isNotEmpty();
       assertThat(pod.getStatus().getContainerStatuses().get(0).getReady()).isTrue();
     });
   }