Skip to content

fix: e2e test crd ready wait #1079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public abstract class AbstractOperatorExtension implements HasKubernetesClient,
AfterEachCallback {

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

private final KubernetesClient kubernetesClient;
protected final ConfigurationService configurationService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ protected void before(ExtensionContext context) {
try (InputStream is = new FileInputStream(crdFile)) {
final var crd = kubernetesClient.load(is);
crd.createOrReplace();
crd.waitUntilReady(2, TimeUnit.SECONDS);
Thread.sleep(CRD_READY_WAIT); // readiness is not applicable for CRD, just wait a little
LOGGER.debug("Applied CRD with name: {}", crd.get().get(0).getMetadata().getName());
} catch (InterruptedException ex) {
LOGGER.error("Interrupted.", ex);
Thread.currentThread().interrupt();
} catch (Exception ex) {
throw new IllegalStateException("Cannot apply CRD yaml: " + crdFile.getAbsolutePath(), ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected void before(ExtensionContext context) {
try (InputStream is = getClass().getResourceAsStream(path)) {
final var crd = kubernetesClient.load(is);
crd.createOrReplace();
Thread.sleep(2000); // readiness is not applicable for CRD, just wait a little
Thread.sleep(CRD_READY_WAIT); // readiness is not applicable for CRD, just wait a little
LOGGER.debug("Applied CRD with name: {}", config.getResourceTypeName());
} catch (InterruptedException ex) {
LOGGER.error("Interrupted.", ex);
Expand Down