generated from kestra-io/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [feature] add sanity checks * feat: add runner to run sanity checks flow --------- Co-authored-by: Mathieu Gabelle <[email protected]>
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
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,28 @@ | ||
package io.kestra.plugin.fs; | ||
|
||
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.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 RunnerTest { | ||
@Test | ||
@ExecuteFlow("sanity-checks/download.yaml") | ||
void download(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(2)); | ||
assertThat(execution.getState().getCurrent(), is(State.Type.SUCCESS)); | ||
} | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/request.yaml") | ||
void request(Execution execution) { | ||
assertThat(execution.getTaskRunList(), hasSize(2)); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
id: download | ||
namespace: qa | ||
|
||
tasks: | ||
- id: download | ||
type: io.kestra.plugin.core.http.Download | ||
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv | ||
|
||
- id: assert | ||
type: io.kestra.plugin.core.execution.Assert | ||
conditions: | ||
- "{{ outputs.download.length == 5837 }}" | ||
- "{{ outputs.download.code == 200 }}" |
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,13 @@ | ||
id: request | ||
namespace: qa | ||
|
||
tasks: | ||
- id: request | ||
type: io.kestra.plugin.core.http.Request | ||
uri: https://dummyjson.com/products | ||
|
||
- id: assert | ||
type: io.kestra.plugin.core.execution.Assert | ||
conditions: | ||
- "{{ outputs.request.code == 200 }}" | ||
- "{{ json(outputs.request.body).products[0].id == 1}}" |