Ensures the CRDs are ready for use after installed (#22622)

also decreases the default poll interval

Closes #22506
This commit is contained in:
Steven Hawkins 2023-08-23 02:52:39 -04:00 committed by GitHub
parent e8abe71833
commit 07a4bc4db1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,6 +51,7 @@ import org.keycloak.operator.crds.v2alpha1.deployment.KeycloakSpecBuilder;
import org.keycloak.operator.crds.v2alpha1.deployment.KeycloakSpecFluent.UnsupportedNested; import org.keycloak.operator.crds.v2alpha1.deployment.KeycloakSpecFluent.UnsupportedNested;
import org.keycloak.operator.crds.v2alpha1.deployment.KeycloakStatus; import org.keycloak.operator.crds.v2alpha1.deployment.KeycloakStatus;
import org.keycloak.operator.crds.v2alpha1.deployment.spec.UnsupportedSpecFluent.PodTemplateNested; import org.keycloak.operator.crds.v2alpha1.deployment.spec.UnsupportedSpecFluent.PodTemplateNested;
import org.keycloak.operator.crds.v2alpha1.realmimport.KeycloakRealmImport;
import org.keycloak.operator.testsuite.utils.K8sUtils; import org.keycloak.operator.testsuite.utils.K8sUtils;
import org.opentest4j.TestAbortedException; import org.opentest4j.TestAbortedException;
@ -63,6 +64,7 @@ import java.net.URL;
import java.time.Duration; import java.time.Duration;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit;
import jakarta.enterprise.inject.Instance; import jakarta.enterprise.inject.Instance;
import jakarta.enterprise.inject.spi.CDI; import jakarta.enterprise.inject.spi.CDI;
@ -156,6 +158,9 @@ public class BaseOperatorTest implements QuarkusTestAfterEachCallback {
static void createCRDs(KubernetesClient client) throws FileNotFoundException { static void createCRDs(KubernetesClient client) throws FileNotFoundException {
K8sUtils.set(client, new FileInputStream(TARGET_KUBERNETES_GENERATED_YML_FOLDER + "keycloaks.k8s.keycloak.org-v1.yml")); K8sUtils.set(client, new FileInputStream(TARGET_KUBERNETES_GENERATED_YML_FOLDER + "keycloaks.k8s.keycloak.org-v1.yml"));
K8sUtils.set(client, new FileInputStream(TARGET_KUBERNETES_GENERATED_YML_FOLDER + "keycloakrealmimports.k8s.keycloak.org-v1.yml")); K8sUtils.set(client, new FileInputStream(TARGET_KUBERNETES_GENERATED_YML_FOLDER + "keycloakrealmimports.k8s.keycloak.org-v1.yml"));
Awaitility.await().pollInterval(100, TimeUnit.MILLISECONDS).untilAsserted(() -> client.resources(Keycloak.class).list());
Awaitility.await().pollInterval(100, TimeUnit.MILLISECONDS).untilAsserted(() -> client.resources(KeycloakRealmImport.class).list());
} }
private static void registerReconcilers() { private static void registerReconcilers() {
@ -239,7 +244,7 @@ public class BaseOperatorTest implements QuarkusTestAfterEachCallback {
} }
private static void setDefaultAwaitilityTimings() { private static void setDefaultAwaitilityTimings() {
Awaitility.setDefaultPollInterval(Duration.ofSeconds(1)); Awaitility.setDefaultPollInterval(Duration.ofMillis(500));
Awaitility.setDefaultTimeout(Duration.ofSeconds(360)); Awaitility.setDefaultTimeout(Duration.ofSeconds(360));
} }