-
-
Notifications
You must be signed in to change notification settings - Fork 160
/
Copy pathst2tests.bat
executable file
·88 lines (74 loc) · 2.4 KB
/
st2tests.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# bats smoke-tests
load "/tools/bats-support/load.bash"
load "/tools/bats-assert/load.bash"
load "/tools/bats-file/load.bash"
@test 'st2 version deployed and python env are as expected' {
run st2 --version
assert_success
# st2 3.8.0, on Python 3.8.10
assert_line --partial "st2 ${ST2_VERSION}"
assert_line --partial 'on Python 3.8.10'
}
@test 'ST2_AUTH_URL service endpoint is accessible and working' {
run curl -v ${ST2_AUTH_URL}
assert_line --partial 'Content-Type: application/json'
assert_line --partial 'St2-Api-Key'
}
@test 'ST2_API_URL service endpoint is accessible and working' {
run curl -v ${ST2_API_URL}
assert_line --partial 'Content-Type: application/json'
assert_line --partial 'St2-Api-Key'
}
@test 'ST2_STREAM_URL service endpoint is accessible and working' {
run curl -v ${ST2_STREAM_URL}
assert_line --partial 'Content-Type: application/json'
assert_line --partial 'St2-Api-Key'
}
@test 'st2 user can log in with auth credentials' {
run st2 login ${ST2_AUTH_USERNAME} --password ${ST2_AUTH_PASSWORD} -w
assert_success
assert_line "Logged in as ${ST2_AUTH_USERNAME}"
assert_file_exist ~/.st2/config
}
@test 'st2 core pack is installed and loaded' {
run st2 action list --pack=core
assert_success
assert_line --partial 'core.local'
}
@test "can execute simple st2 action 'core.local'" {
run st2 run core.local cmd=id
assert_success
assert_line --partial 'return_code: 0'
assert_line --partial "stderr: ''"
assert_line --partial 'stdout: uid=1000(stanley) gid=1000(stanley) groups=1000(stanley)'
assert_line --partial 'succeeded: true'
}
@test 'st2 chatops core rule is loaded' {
run st2 rule list
assert_success
assert_line --partial 'chatops.notify'
}
@test 'st2 key/value operations are functional' {
run st2 key set foo bar
assert_success
run st2 key get foo
assert_success
assert_line --partial 'bar'
run st2 key delete foo
assert_line --partial '"foo" has been successfully deleted'
assert_success
run st2 key get foo
assert_line --partial '"foo" is not found'
assert_failure
}
# TODO: RBAC isn't loaded automatically for st2-docker. Uncomment when/if RBAC is loaded on startup
#@test 'RBAC is loaded and enabled' {
# if [ $ST2_RBAC_ENABLED != "true" ]; then
# skip "disabled in Helm values"
# fi
#
# run st2 whoami
# assert_success
# assert_output --regexp 'RBAC:\s+ - Enabled: True'
# assert_line --partial 'Roles: system_admin'
#}