Skip to content

Commit 08ce423

Browse files
committed
Use assert_line instead of assert_output
1 parent c0e5fd5 commit 08ce423

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

docs/test_basic.bats

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ load '../test_helpers/bats-assert/load'
88
run st2 --version
99
assert_success
1010

11-
assert_output --regexp "^st2 "
12-
assert_output --partial "on Python"
11+
assert_line --regexp "^st2 "
12+
assert_line --partial "on Python"
1313
}
1414

1515
@test "st2 usage works" {
@@ -24,7 +24,7 @@ load '../test_helpers/bats-assert/load'
2424
run st2 -h
2525
assert_success
2626

27-
assert_output --regexp "^usage:"
27+
assert_line --regexp "^usage:"
2828
assert_output --partial "CLI for StackStorm event-driven automation platform."
2929
assert_output --partial "Enable debug mode"
3030
}
@@ -54,7 +54,7 @@ load '../test_helpers/bats-assert/load'
5454
run eval "st2 action get -j core.http | jq -r '.ref'"
5555
assert_success
5656

57-
assert_output "core.http"
57+
assert_line "core.http"
5858

5959
run eval "st2 action get -j core.http | jq -r '.parameters.method.enum | .[]'"
6060
assert_success
@@ -74,19 +74,19 @@ load '../test_helpers/bats-assert/load'
7474
run eval "st2 run -j core.local -- date -R | jq -r '.status'"
7575
assert_success
7676

77-
assert_output "succeeded"
77+
assert_line "succeeded"
7878

7979
run eval "st2 run -j core.local -- date -R | jq -r '.parameters.cmd'"
8080
assert_success
81-
assert_output "date -R"
81+
assert_line "date -R"
8282

8383
run eval "st2 execution list -n 1 -j | jq -r '.[].action.ref'"
8484
assert_success
85-
assert_output "core.local"
85+
assert_line "core.local"
8686

8787
run eval "st2 execution list -n 1 -j | jq -r '.[].status'"
8888
assert_success
89-
assert_output "succeeded"
89+
assert_line "succeeded"
9090
}
9191

9292
@test "sensor list works" {
@@ -100,25 +100,25 @@ load '../test_helpers/bats-assert/load'
100100
run eval "st2 trigger list -j -a=all | jq -r '.[].pack = \"core\" | length'"
101101
assert_success
102102

103-
[[ "$output" -gt 15 ]]
103+
assert_line --regexp "[[:digit:]]{1,}"
104104
}
105105

106106
@test "trigger get works" {
107107
TRIGGER_ID=$(st2 trigger list -j -a=all | jq -r '.[4].id')
108108
run eval "st2 trigger get -j $TRIGGER_ID | jq -r '.id'"
109109
assert_success
110110

111-
assert_output "$TRIGGER_ID"
111+
assert_line "$TRIGGER_ID"
112112
}
113113

114114
@test "core.remote action works" {
115115
run eval "st2 run -j core.remote hosts=\"localhost\" -- uname -a | jq -r '.parameters.cmd'"
116116
assert_success
117117

118-
assert_output "uname -a"
118+
assert_line "uname -a"
119119

120120
run eval "st2 run -j core.remote hosts=\"localhost\" -- uname -a | jq -r '.parameters.hosts'"
121121
assert_success
122122

123-
assert_output "localhost"
123+
assert_line "localhost"
124124
}

docs/test_integration_packs_doc.bats

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ load '../test_helpers/bats-assert/load'
2424
run eval "st2 action list --pack libcloud -j | jq '. | length'"
2525
assert_success
2626

27-
assert_output --regexp '^[[:digit:]]{1,}$'
27+
assert_line --regexp '^[[:digit:]]{1,}$'
2828
refute_output '0'
2929
}
3030

3131
@test "list actions in consul pack" {
3232
run eval "st2 action list --pack consul -j | jq '. | length'"
3333
assert_success
3434

35-
assert_output --regexp '^[[:digit:]]{1,}$'
35+
assert_line --regexp '^[[:digit:]]{1,}$'
3636
refute_output '0'
3737
}
3838

@@ -48,39 +48,39 @@ load '../test_helpers/bats-assert/load'
4848
run st2 action list --pack libcloud -j
4949
assert_success
5050

51-
assert_output "No matching items found"
51+
assert_line "No matching items found"
5252
}
5353

5454
@test "no actions in consul pack" {
5555
run st2 action list --pack consul -j
5656
assert_success
5757

58-
assert_output "No matching items found"
58+
assert_line "No matching items found"
5959
}
6060

6161
@test "packs can be downloaded using packs.download" {
6262
DOWNLOAD_RESULTS=$(st2 run packs.download packs=libcloud -j)
6363
run eval "echo '$DOWNLOAD_RESULTS' | jq -r '.status'"
6464
assert_success
6565

66-
assert_output "succeeded"
66+
assert_line "succeeded"
6767

6868
run eval "echo '$DOWNLOAD_RESULTS' | jq -r '.result.result.libcloud'"
6969
assert_success
7070

71-
assert_output "Success."
71+
assert_line "Success."
7272
}
7373

7474
@test "can run packs.setup_virtualenv for a pack downloaded in previous step" {
7575
run eval "st2 run packs.setup_virtualenv packs=libcloud -j | jq -r '.status'"
7676
assert_success
7777

78-
assert_output "succeeded"
78+
assert_line "succeeded"
7979

8080
run eval "st2 run packs.setup_virtualenv packs=libcloud -j | jq -r '.result.result'"
8181
assert_success
8282

83-
assert_output "Successfully set up virtualenv for the following packs: libcloud"
83+
assert_line "Successfully set up virtualenv for the following packs: libcloud"
8484
}
8585

8686
@test "packs register registers all packs" {
@@ -140,12 +140,12 @@ load '../test_helpers/bats-assert/load'
140140
run eval "st2 run packs.download packs=bitcoin -j | jq -r '.result.result.bitcoin'"
141141
assert_success
142142

143-
assert_output "Success."
143+
assert_line "Success."
144144
}
145145

146146
@test "pack reinstall with no config" {
147147
run eval "st2 run packs.download packs=bitcoin -j | jq -r '.result.result.bitcoin'"
148148
assert_success
149149

150-
assert_output "Success."
150+
assert_line "Success."
151151
}

docs/test_key_triggers.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ KEY_JSON_FILE="docs/test_key_triggers.json"
138138
run eval "st2 key delete \"$ROBOT_KEY\""
139139
assert_success
140140

141-
assert_output "Resource with id \"$ROBOT_KEY\" has been successfully deleted."
141+
assert_line "Resource with id \"$ROBOT_KEY\" has been successfully deleted."
142142

143143
KEY_DELETE_RESULTS=$(st2 trigger-instance list --trigger=$TRIGGER_KEY_DELETE -n 1 -j)
144144
run eval "echo '$KEY_DELETE_RESULTS' | jq -r '.[].trigger'"
@@ -215,7 +215,7 @@ KEY_JSON_FILE="docs/test_key_triggers.json"
215215
run eval "st2 key delete 1 -j"
216216
assert_success
217217

218-
assert_output "Resource with id \"1\" has been successfully deleted."
218+
assert_line "Resource with id \"1\" has been successfully deleted."
219219
}
220220

221221
@test "key-value operations with expiries" {

0 commit comments

Comments
 (0)