Skip to content

Commit 29adcd5

Browse files
authored
fix: e2e test crd ready wait (#1079)
1 parent 4e350ec commit 29adcd5

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

operator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/AbstractOperatorExtension.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public abstract class AbstractOperatorExtension implements HasKubernetesClient,
3232
AfterEachCallback {
3333

3434
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractOperatorExtension.class);
35+
public static final int CRD_READY_WAIT = 2000;
3536

3637
private final KubernetesClient kubernetesClient;
3738
protected final ConfigurationService configurationService;

operator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/E2EOperatorExtension.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ protected void before(ExtensionContext context) {
6464
try (InputStream is = new FileInputStream(crdFile)) {
6565
final var crd = kubernetesClient.load(is);
6666
crd.createOrReplace();
67-
crd.waitUntilReady(2, TimeUnit.SECONDS);
67+
Thread.sleep(CRD_READY_WAIT); // readiness is not applicable for CRD, just wait a little
6868
LOGGER.debug("Applied CRD with name: {}", crd.get().get(0).getMetadata().getName());
69+
} catch (InterruptedException ex) {
70+
LOGGER.error("Interrupted.", ex);
71+
Thread.currentThread().interrupt();
6972
} catch (Exception ex) {
7073
throw new IllegalStateException("Cannot apply CRD yaml: " + crdFile.getAbsolutePath(), ex);
7174
}

operator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/OperatorExtension.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ protected void before(ExtensionContext context) {
120120
try (InputStream is = getClass().getResourceAsStream(path)) {
121121
final var crd = kubernetesClient.load(is);
122122
crd.createOrReplace();
123-
Thread.sleep(2000); // readiness is not applicable for CRD, just wait a little
123+
Thread.sleep(CRD_READY_WAIT); // readiness is not applicable for CRD, just wait a little
124124
LOGGER.debug("Applied CRD with name: {}", config.getResourceTypeName());
125125
} catch (InterruptedException ex) {
126126
LOGGER.error("Interrupted.", ex);

0 commit comments

Comments
 (0)