mirror of
https://github.com/nick-fields/retry.git
synced 2026-10-11 14:34:15 +03:00
tests
This commit is contained in:
1 parent
29e1861bc1
commit
4d604b1776
2 files changed
+77
-1
No files matched your search
@@ -36,6 +36,78 @@ jobs:
|
|||||||
command: node ./.github/scripts/log-examples.js
|
command: node ./.github/scripts/log-examples.js
|
||||||
timeout_minutes: 1
|
timeout_minutes: 1
|
||||||
|
|
||||||
|
- name: multi-line 2 commands non existent first command
|
||||||
|
id: multi_line_2_commands_non_existent_first_command
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
max_attempts: 2
|
||||||
|
command: |
|
||||||
|
i-do-not-exist && \
|
||||||
|
echo "bar"
|
||||||
|
- uses: nick-invision/assert-action@v1
|
||||||
|
with:
|
||||||
|
expected: 3
|
||||||
|
actual: ${{ steps.multi_line_2_commands_non_existent_first_command.outputs.total_attempts }}
|
||||||
|
- uses: nick-invision/assert-action@v1
|
||||||
|
with:
|
||||||
|
expected: 'i-do-not-exist'
|
||||||
|
actual: ${{ steps.multi_line_2_commands_non_existent_first_command.outputs.exit_error }}
|
||||||
|
comparison: contains
|
||||||
|
- uses: nick-invision/assert-action@v1
|
||||||
|
with:
|
||||||
|
expected: 'i-exist'
|
||||||
|
actual: ${{ steps.multi_line_2_commands_non_existent_first_command.outputs.exit_error }}
|
||||||
|
comparison: notContains
|
||||||
|
|
||||||
|
- name: multi-line 2 commands happy path test
|
||||||
|
id: multi_line_2_commands_happy_path
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
max_attempts: 2
|
||||||
|
command: |
|
||||||
|
echo "foo" && \
|
||||||
|
echo "bar"
|
||||||
|
- uses: nick-invision/assert-action@v1
|
||||||
|
with:
|
||||||
|
expected: 1
|
||||||
|
actual: ${{ steps.multi_line_2_commands_happy_path.outputs.total_attempts }}
|
||||||
|
|
||||||
|
- name: Conventional multi-line non existent first command
|
||||||
|
id: conventional_multi_line_non_existent_first_command
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
max_attempts: 2
|
||||||
|
command: |
|
||||||
|
i-do-not-exist
|
||||||
|
echo "i-exist"
|
||||||
|
- uses: nick-invision/assert-action@v1
|
||||||
|
with:
|
||||||
|
expected: 3
|
||||||
|
actual: ${{ steps.conventional_multi_line_non_existent_second_command.outputs.total_attempts }}
|
||||||
|
- uses: nick-invision/assert-action@v1
|
||||||
|
with:
|
||||||
|
expected: 'i-do-not-exist'
|
||||||
|
actual: ${{ steps.conventional_multi_line_non_existent_first_command.outputs.exit_error }}
|
||||||
|
comparison: contains
|
||||||
|
- uses: nick-invision/assert-action@v1
|
||||||
|
with:
|
||||||
|
expected: 'i-exist'
|
||||||
|
actual: ${{ steps.conventional_multi_line_non_existent_first_command.outputs.exit_error }}
|
||||||
|
comparison: notContains
|
||||||
|
|
||||||
|
- name: Conventional multi-line happy path test
|
||||||
|
id: conventional_multi_line_happy_path
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
max_attempts: 2
|
||||||
|
command: |
|
||||||
|
echo "foo"
|
||||||
|
echo "bar"
|
||||||
|
- uses: nick-invision/assert-action@v1
|
||||||
|
with:
|
||||||
|
expected: 0
|
||||||
|
actual: ${{ steps.conventional_multi_line_happy_path.outputs.total_attempts }}
|
||||||
|
|
||||||
- name: sad-path (retry_wait_seconds)
|
- name: sad-path (retry_wait_seconds)
|
||||||
id: sad_path_wait_sec
|
id: sad_path_wait_sec
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
+5
-1
@@ -83,7 +83,11 @@ function getExecutable(): string {
|
|||||||
|
|
||||||
let executable: string;
|
let executable: string;
|
||||||
switch (SHELL) {
|
switch (SHELL) {
|
||||||
case "bash":
|
case "bash": {
|
||||||
|
// -e to not ignore errors, but exit with non-zero code.
|
||||||
|
executable = SHELL + "-e";
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "python":
|
case "python":
|
||||||
case "pwsh": {
|
case "pwsh": {
|
||||||
executable = SHELL;
|
executable = SHELL;
|
||||||
|
|||||||
Reference in new issue
Block a user