-
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.
feat(core): add sanity check to request task
- Loading branch information
nKwiatkowski
committed
Feb 6, 2025
1 parent
4c401ce
commit d6ffc18
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
core/src/test/java/io/kestra/plugin/core/http/RequestRunnerTest.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,23 @@ | ||
package io.kestra.plugin.core.http; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
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; | ||
|
||
@KestraTest(startRunner = true) | ||
public class RequestRunnerTest { | ||
|
||
@Test | ||
@ExecuteFlow("sanity-checks/request.yaml") | ||
void logExporter(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,16 @@ | ||
id: request | ||
namespace: sanitycheck.plugin.core.http | ||
|
||
tasks: | ||
- id: request | ||
type: io.kestra.plugin.core.http.Request | ||
uri: https://www.google.com | ||
method: GET | ||
options: | ||
connectionPoolIdleTimeout: PT1M | ||
|
||
- id: assert | ||
type: io.kestra.plugin.core.execution.Assert | ||
errorMessage: "Invalid response code {{ outputs.request.code }}" | ||
conditions: | ||
- "{{ outputs.request.code == 200 }}" |