-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add runner class to run sanity checks flows
- Loading branch information
Showing
7 changed files
with
118 additions
and
99 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
core/src/test/java/io/kestra/core/tasks/test/SanityCheckTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
package io.kestra.core.tasks.test; | ||
|
||
import io.kestra.core.junit.annotations.ExecuteFlow; | ||
import io.kestra.core.junit.annotations.KestraTest; | ||
import io.kestra.core.models.executions.Execution; | ||
import io.kestra.core.models.executions.TaskRun; | ||
import io.kestra.core.models.flows.State; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
@KestraTest(startRunner = true) | ||
class SanityCheckTest { | ||
@Test | ||
@ExecuteFlow("sanity-checks/qa.fail.yaml") | ||
void qaFail(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(1)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.fetch.yaml") | ||
void qaFetch(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(5)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.if.yaml") | ||
void qaIf(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(8)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.kv.yaml") | ||
void qaKv(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(6)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.labels.yaml") | ||
void qaLabels(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(2)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.namespace_files.yaml") | ||
void qaNamespaceFiles(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(8)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.parallel.yaml") | ||
void qaParallel(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(4)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.pause.yaml") | ||
void qaPause(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(1)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.purge_current_execution_files.yaml") | ||
void qaPurgeExecutionFiles(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(2)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.return.yaml") | ||
void qaReturn(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(2)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
|
||
TaskRun taskRun = execution.findTaskRunsByTaskId("return_value").getFirst(); | ||
assertThat(taskRun.getOutputs().get("value"), is("some string with pebble test")); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.sequential.yaml") | ||
void qaSequential(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(5)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.sleep.yaml") | ||
void qaSleep(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(4)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
Check failure on line 100 in core/src/test/java/io/kestra/core/tasks/test/SanityCheckTest.java GitHub Actions / JUnit Test ReportSanityCheckTest.qaSleep(Execution)
Raw output
|
||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.switch.yaml") | ||
void qaSwitch(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(3)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/qa.write.yaml") | ||
void qaWrite(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(3)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
core/src/test/resources/sanity-checks/qa.for_each_item.yaml
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
core/src/test/resources/sanity-checks/qa.for_each_item_subflow.yaml
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
core/src/test/resources/sanity-checks/qa.for_each_subflow.yaml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.