-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathtests.bats
More file actions
167 lines (127 loc) · 3.61 KB
/
Copy pathtests.bats
File metadata and controls
167 lines (127 loc) · 3.61 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/usr/bin/env bats
HUMIO_PORT=${HUMIO_PORT:-8081}
humioctl="$BATS_TEST_DIRNAME/../bin/humioctl --address=http://localhost:$HUMIO_PORT/"
load './node_modules/bats-support/load'
load './node_modules/bats-assert/load'
## Health Commands
@test "health" {
run $humioctl health
}
## Cluster Commands
@test "cluster nodes list" {
run $humioctl cluster nodes list
assert_output -p "localhost:8080"
}
@test "cluster nodes show" {
run $humioctl cluster nodes show 1
assert_success
assert_output -p "UUID"
}
## View Commands
@test "views list" {
run $humioctl views list
assert_success
assert_output -p "humio-audit"
}
@test "views show" {
$humioctl views show humio-audit
}
@test "views show <unknown>" {
run $humioctl views show foo
assert_failure 1
}
## User Commands
@test "users show" {
run $humioctl users show developer
assert_success
assert_output -p "developer"
}
@test "users add" {
$humioctl users add --email "[email protected]" --root true --name "Anders" anders
}
@test "users add <already exists>" {
run $humioctl users add --email "[email protected]" --root true --name "Peter" peter
assert_success
run $humioctl users add --email "[email protected]" --root true --name "Peter" peter
assert_failure 1
}
@test "users list" {
run $humioctl users add --email "[email protected]" --root false --name "Jens" jens
assert_success
run $humioctl users list
assert_success
assert_output -p "Jens"
}
@test "users update" {
$humioctl users add --email "[email protected]" --name "Odin" odin
$humioctl users update --name 'Othello' odin
run $humioctl users show odin
assert_success
assert_output -p 'Othello'
}
# Status Commands
@test "status" {
run $humioctl status
assert_success
assert_output -p 'Version'
}
# License Commands
@test "license install" {
skip # TODO: This fails in the test build susseeds with manual tests.
# we keep getting 'error installing license: Invalid input' in the test.
# Why is that?
# Humio will accept an expired license, but limit usage.
run $humioctl license install "$BATS_TEST_DIRNAME/licenses/expired.pem"
assert_success
assert_output "OK"
}
@test "license install <invalid license>" {
run $humioctl license install "$BATS_TEST_DIRNAME/licenses/invalid.pem"
assert_failure
}
@test "license show" {
$humioctl license show
}
# Alerts
@test "alerts list" {
$humioctl alerts list humio
}
# Actions
@test "actions list" {
$humioctl actions list humio
}
# Ingest Token Commands
@test "ingest-tokens add" {
run $humioctl ingest-tokens add humio "test123" --parser "kv"
assert_success
assert_output -p "test123"
assert_output -p "kv"
}
@test "ingest-tokens update change parser" {
$humioctl ingest-tokens add humio "updateParser" --parser "kv"
run $humioctl ingest-tokens update humio "updateParser" --parser "json"
assert_output -p "updateParser"
assert_output -p "json"
}
@test "ingest-tokens update remove parser" {
$humioctl ingest-tokens add humio "removeParser" --parser "kv"
run $humioctl ingest-tokens update humio "removeParser"
assert_output -p "removeParser"
}
@test "ingest-tokens list" {
$humioctl ingest-tokens add humio "foo"
run $humioctl ingest-tokens list humio
assert_success
assert_output -p "Assigned Parser"
}
# Parser Commands
@test "parser install" {
run $humioctl parsers install --file parsers/accesslog2.yaml humio
assert_success
}
@test "parser remove" {
$humioctl parsers install --file parsers/accesslog2.yaml --name accesslog3 humio
run $humioctl parsers remove humio accesslog3
assert_success
assert_output -p "Successfully removed parser \"accesslog3\" from repository \"humio\""
}