Skip to content

Commit

Permalink
fix(tests): replace DefaultScheduler with JdbcScheduler & fix some qu…
Browse files Browse the repository at this point in the history
…eue.receive to work with JDBC (linked to kestra-io/kestra#3948)
  • Loading branch information
brian-mulier-p committed Jun 12, 2024
1 parent fa463bb commit 046c269
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
13 changes: 4 additions & 9 deletions src/test/java/io/kestra/plugin/pulsar/RealtimeTriggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
import io.kestra.core.runners.RunContextFactory;
import io.kestra.core.runners.Worker;
import io.kestra.core.schedulers.AbstractScheduler;
import io.kestra.core.schedulers.DefaultScheduler;
import io.kestra.core.schedulers.SchedulerTriggerStateInterface;
import io.kestra.core.utils.TestsUtils;
import io.kestra.jdbc.runner.JdbcScheduler;
import io.micronaut.context.ApplicationContext;
import io.kestra.core.junit.annotations.KestraTest;
import jakarta.inject.Inject;
Expand All @@ -34,9 +33,6 @@ class RealtimeTriggerTest {
@Inject
private ApplicationContext applicationContext;

@Inject
private SchedulerTriggerStateInterface triggerState;

@Inject
private FlowListeners flowListenersService;

Expand All @@ -57,16 +53,15 @@ void flow() throws Exception {
// scheduler
try (
Worker worker = applicationContext.createBean(Worker.class, UUID.randomUUID().toString(), 8, null);
AbstractScheduler scheduler = new DefaultScheduler(
AbstractScheduler scheduler = new JdbcScheduler(
this.applicationContext,
this.flowListenersService,
this.triggerState
this.flowListenersService
);
) {
AtomicReference<Execution> last = new AtomicReference<>();

// wait for execution
executionQueue.receive(RealtimeTriggerTest.class, execution -> {
executionQueue.receive(execution -> {
last.set(execution.getLeft());

queueCount.countDown();
Expand Down
13 changes: 4 additions & 9 deletions src/test/java/io/kestra/plugin/pulsar/TriggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import io.kestra.core.runners.RunContextFactory;
import io.kestra.core.runners.Worker;
import io.kestra.core.schedulers.AbstractScheduler;
import io.kestra.core.schedulers.DefaultScheduler;
import io.kestra.core.schedulers.SchedulerTriggerStateInterface;
import io.kestra.jdbc.runner.JdbcScheduler;
import io.kestra.core.utils.TestsUtils;
import io.micronaut.context.ApplicationContext;
import io.kestra.core.junit.annotations.KestraTest;
Expand All @@ -33,9 +32,6 @@ class TriggerTest {
@Inject
private ApplicationContext applicationContext;

@Inject
private SchedulerTriggerStateInterface triggerState;

@Inject
private FlowListeners flowListenersService;

Expand All @@ -56,16 +52,15 @@ void flow() throws Exception {
// scheduler
Worker worker = new Worker(applicationContext, 8, null);
try (
AbstractScheduler scheduler = new DefaultScheduler(
AbstractScheduler scheduler = new JdbcScheduler(
this.applicationContext,
this.flowListenersService,
this.triggerState
this.flowListenersService
);
) {
AtomicReference<Execution> last = new AtomicReference<>();

// wait for execution
executionQueue.receive(TriggerTest.class, execution -> {
executionQueue.receive(execution -> {
last.set(execution.getLeft());

queueCount.countDown();
Expand Down

0 comments on commit 046c269

Please sign in to comment.