use of io.quarkus.runtime.StartupEvent in project entando-k8s-controller-coordinator by entando-k8s.
the class PodManagementTests method shouldGarbageCollectSuccessulPods.
@Test
@Description("Should automatically remove successful controller pods once the resource has progress to the 'successful' phase")
void shouldGarbageCollectSuccessulPods() {
step("Given I have activated controller Pod garbage collection with a removal delay of 1 second", () -> {
System.setProperty(ControllerCoordinatorProperty.ENTANDO_K8S_CONTROLLER_REMOVAL_DELAY.getJvmSystemProperty(), "1");
System.setProperty(EntandoOperatorConfigProperty.ENTANDO_K8S_OPERATOR_GC_CONTROLLER_PODS.getJvmSystemProperty(), "true");
});
step("And the Coordinator observes its own namespace", () -> {
System.setProperty(EntandoOperatorConfigProperty.ENTANDO_NAMESPACES_TO_OBSERVE.getJvmSystemProperty(), clientDouble.getNamespace());
coordinator.onStartup(new StartupEvent());
});
ValueHolder<SerializedEntandoResource> testResource = new ValueHolder<>();
step("And I have created a new TestResource resource", () -> {
TestResource f = new TestResource().withNames(clientDouble.getNamespace(), "test-keycloak").withSpec(new BasicDeploymentSpecBuilder().withDbms(DbmsVendor.EMBEDDED).build());
f.getMetadata().setGeneration(1L);
testResource.set(clientDouble.createOrPatchEntandoResource(CoordinatorTestUtils.toSerializedResource(f)));
attachment("TestResource", objectMapper.writeValueAsString(testResource.get()));
});
step("And I have waited for the controller pod to be created", () -> {
await().ignoreExceptions().atMost(3, TimeUnit.SECONDS).until(() -> clientDouble.loadPod(clientDouble.getNamespace(), labelsFromResource(testResource.get())) != null);
attachment("Controller Pod", objectMapper.writeValueAsString(clientDouble.loadPod(clientDouble.getNamespace(), labelsFromResource(testResource.get()))));
});
step("When I complete the deployment of the TestResource successfully", () -> {
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.submit(() -> {
clientDouble.updatePodStatus(podWithSucceededStatus(clientDouble.loadPod(clientDouble.getNamespace(), labelsFromResource(testResource.get()))));
});
attachment("Suffessful Resource", objectMapper.writeValueAsString(clientDouble.updatePhase(testResource.get(), EntandoDeploymentPhase.SUCCESSFUL)));
});
step("Then the previously created, but successfully completed controller pod will be removed", () -> await().ignoreExceptions().atMost(3, TimeUnit.SECONDS).until(() -> clientDouble.loadPod(clientDouble.getNamespace(), labelsFromResource(testResource.get())) == null));
}
use of io.quarkus.runtime.StartupEvent in project jobrunr by jobrunr.
the class JobRunrStarterTest method jobRunrStarterStartsDashboardIfConfigured.
@Test
void jobRunrStarterStartsDashboardIfConfigured() {
dashboardConfiguration.enabled = true;
jobRunrStarter.startup(new StartupEvent());
verify(dashboardWebServer).start();
}
use of io.quarkus.runtime.StartupEvent in project jobrunr by jobrunr.
the class JobRunrStarterTest method jobRunrStarterStartsBackgroundJobServerIfConfigured.
@Test
void jobRunrStarterStartsBackgroundJobServerIfConfigured() {
backgroundJobServerConfiguration.enabled = true;
jobRunrStarter.startup(new StartupEvent());
verify(backgroundJobServer).start();
}
use of io.quarkus.runtime.StartupEvent in project jobrunr by jobrunr.
the class JobRunrStarterTest method jobRunrStarterDoesNotStartDashboardIfNotConfigured.
@Test
void jobRunrStarterDoesNotStartDashboardIfNotConfigured() {
dashboardConfiguration.enabled = false;
jobRunrStarter.startup(new StartupEvent());
verify(dashboardWebServerInstance, never()).get();
}
use of io.quarkus.runtime.StartupEvent in project jobrunr by jobrunr.
the class JobRunrMetricsStarterTest method metricsStarterDoesNotStartBackgroundJobServerMetricsBinderIfNotAvailable.
@Test
void metricsStarterDoesNotStartBackgroundJobServerMetricsBinderIfNotAvailable() {
jobRunrMetricsStarter.startup(new StartupEvent());
verify(backgroundJobServerMetricsBinderInstance, never()).get();
}
Aggregations