Skip to content

Commit

Permalink
fix(tests): introduce @KestraTest (linked to kestra-io/kestra#3948)
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-mulier-p committed Jun 12, 2024
1 parent 377547b commit 245b742
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ dependencies {

// test deps needed only for to have a runner
testImplementation group: "io.kestra", name: "core", version: kestraVersion
testImplementation group: "io.kestra", name: "core", version: kestraVersion, classifier: "tests"
testImplementation group: "io.kestra", name: "repository-memory", version: kestraVersion
testImplementation group: "io.kestra", name: "runner-memory", version: kestraVersion
testImplementation group: "io.kestra", name: "storage-local", version: kestraVersion
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/kestra/plugin/amqp/AMQPTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.kestra.core.storages.StorageInterface;
import io.kestra.plugin.amqp.models.Message;
import io.kestra.plugin.amqp.models.SerdeType;
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import io.kestra.core.junit.annotations.KestraTest;
import jakarta.inject.Inject;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -27,7 +27,7 @@
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.assertThrows;

@MicronautTest
@KestraTest
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class AMQPTest {
@Inject
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/io/kestra/plugin/amqp/AbstractTriggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
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.serializers.JacksonMapper;
import io.kestra.core.utils.IdUtils;
import io.kestra.core.utils.TestsUtils;
import io.kestra.jdbc.runner.JdbcScheduler;
import io.kestra.plugin.amqp.models.Message;
import io.micronaut.context.ApplicationContext;
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import io.kestra.core.junit.annotations.KestraTest;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import org.junit.jupiter.api.BeforeAll;
Expand All @@ -28,7 +28,7 @@
import java.util.Arrays;
import java.util.Objects;

@MicronautTest
@KestraTest
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
abstract class AbstractTriggerTest {
@Inject
Expand Down Expand Up @@ -71,9 +71,9 @@ void setUp() throws Exception {
queueBind.run(runContextFactory.of());
}

protected void run(String filename, Runnable runnable) throws IOException, URISyntaxException, InterruptedException {
protected void run(String filename, Runnable runnable) throws IOException, URISyntaxException {
try (
AbstractScheduler scheduler = new DefaultScheduler(this.applicationContext, this.flowListenersService, this.triggerState);
AbstractScheduler scheduler = new JdbcScheduler(this.applicationContext, this.flowListenersService);
Worker worker = applicationContext.createBean(Worker.class, IdUtils.create(), 8, null);
) {
worker.run();
Expand Down

0 comments on commit 245b742

Please sign in to comment.