* ci: run stable tests partially * ci: improve uploading test result * use buildkite's retry * test common * fix indent issue * extract assert eq * use diff to print test error * pretty format * test build stable steps * add test all function * lint * lint * keep dollar sign * switch got and want's diff direction * use 'EOF' to make code more readable * rename EMPTY_LINE to DELETE_THIS_LINE * rename N => INDEX * rename M => LIMIT * check variable in a more elegant way * wording * more explain for code
82 lines
1.5 KiB
Bash
Executable File
82 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
here=$(dirname "$0")
|
|
|
|
# shellcheck source=.buildkite/scripts/func-assert-eq.sh
|
|
source "$here"/func-assert-eq.sh
|
|
|
|
# shellcheck source=.buildkite/scripts/common.sh
|
|
source "$here"/common.sh
|
|
|
|
(
|
|
want=$(
|
|
cat <<EOF | indent
|
|
- name: "test"
|
|
command: "start.sh"
|
|
timeout_in_minutes: 10
|
|
agents:
|
|
queue: "agent"
|
|
EOF
|
|
)
|
|
|
|
got=$(step '{ "name": "test", "command": "start.sh", "timeout_in_minutes": 10, "agent": "agent"}')
|
|
|
|
assert_eq "basic setup" "$want" "$got"
|
|
)
|
|
|
|
(
|
|
want=$(
|
|
cat <<EOF | indent
|
|
- name: "test"
|
|
command: "start.sh"
|
|
timeout_in_minutes: 10
|
|
agents:
|
|
queue: "agent"
|
|
parallelism: 3
|
|
EOF
|
|
)
|
|
|
|
got=$(step '{ "name": "test", "command": "start.sh", "timeout_in_minutes": 10, "agent": "agent", "parallelism": 3}')
|
|
|
|
assert_eq "basic setup + parallelism" "$want" "$got"
|
|
)
|
|
|
|
(
|
|
want=$(
|
|
cat <<EOF | indent
|
|
- name: "test"
|
|
command: "start.sh"
|
|
timeout_in_minutes: 10
|
|
agents:
|
|
queue: "agent"
|
|
retry:
|
|
automatic:
|
|
- limit: 3
|
|
EOF
|
|
)
|
|
|
|
got=$(step '{ "name": "test", "command": "start.sh", "timeout_in_minutes": 10, "agent": "agent", "retry": 3}')
|
|
|
|
assert_eq "basic setup + retry" "$want" "$got"
|
|
)
|
|
|
|
(
|
|
want=$(
|
|
cat <<EOF | indent
|
|
- name: "test"
|
|
command: "start.sh"
|
|
timeout_in_minutes: 10
|
|
agents:
|
|
queue: "agent"
|
|
parallelism: 3
|
|
retry:
|
|
automatic:
|
|
- limit: 3
|
|
EOF
|
|
)
|
|
|
|
got=$(step '{ "name": "test", "command": "start.sh", "timeout_in_minutes": 10, "agent": "agent", "parallelism": 3, "retry": 3}')
|
|
|
|
assert_eq "basic setup + parallelism + retry" "$want" "$got"
|
|
) |