Skip to content

Commit c92fae7

Browse files
committed
use st2 as test intermediary
1 parent 4dab18e commit c92fae7

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

tests/st2tests.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ load "${BATS_HELPERS_DIR}/bats-file/load.bash"
3030
assert_line --partial 'St2-Api-Key'
3131
}
3232

33-
@test 'stanley_rsa file has correct permissions and ownership' {
34-
local private_key="/home/stanley/.ssh/stanley_rsa"
35-
assert_file_exist "${private_key}"
36-
assert_file_not_empty "${private_key}"
37-
assert_file_permission "500" "${private_key}"
38-
assert_file_permission "400" "${private_key}"
39-
assert_file_owner "stanley" "${private_key}"
40-
}
41-
4233
@test 'st2 user can log in with auth credentials' {
4334
run st2 login ${ST2_AUTH_USERNAME} --password ${ST2_AUTH_PASSWORD} -w
4435
assert_success
@@ -61,6 +52,18 @@ load "${BATS_HELPERS_DIR}/bats-file/load.bash"
6152
assert_line --partial 'succeeded: true'
6253
}
6354

55+
@test 'stanley_rsa file has correct permissions and ownership' {
56+
local ssh_dir="/home/stanley/.ssh"
57+
local private_key="${ssh_dir}/stanley_rsa"
58+
run st2 run core.local cmd="find ${ssh_dir} -printf '%p: %u %g %m\n'"
59+
assert_success
60+
assert_line --partial 'return_code: 0'
61+
assert_line --partial "stderr: ''"
62+
assert_line --partial "${ssh_dir}: stanley stanley 500"
63+
assert_line --partial "${private_key}: stanley stanley 400"
64+
assert_line --partial 'succeeded: true'
65+
}
66+
6467
@test 'st2 chatops core rule is loaded' {
6568
run st2 rule list
6669
assert_success

0 commit comments

Comments
 (0)