/usr/lib/python3/dist-packages/gnocchi/tests/functional/gabbits/archive-rule.yaml is in python3-gnocchi 4.2.0-0ubuntu5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | #
## Test the Archive Policy API to achieve coverage of just the
## ArchivePolicyRulesController.
##
#
fixtures:
- ConfigFixture
defaults:
request_headers:
# User foobar
authorization: "basic Zm9vYmFyOg=="
content-type: application/json
tests:
# create dependent policy
- name: create archive policy
POST: /v1/archive_policy
request_headers:
# User admin
authorization: "basic YWRtaW46"
data:
name: low
definition:
- granularity: 1 hour
status: 201
response_headers:
location: $SCHEME://$NETLOC/v1/archive_policy/low
# Attempt to create an archive policy rule
- name: create archive policy rule1
POST: /v1/archive_policy_rule
request_headers:
# User admin
authorization: "basic YWRtaW46"
data:
name: test_rule1
metric_pattern: "*"
archive_policy_name: low
status: 201
response_json_paths:
$.metric_pattern: "*"
$.archive_policy_name: low
$.name: test_rule1
- name: create archive policy rule 2
POST: /v1/archive_policy_rule
request_headers:
# User admin
authorization: "basic YWRtaW46"
data:
name: test_rule2
metric_pattern: "disk.foo.*"
archive_policy_name: low
status: 201
response_json_paths:
$.metric_pattern: disk.foo.*
$.archive_policy_name: low
$.name: test_rule2
- name: create archive policy rule 3
POST: /v1/archive_policy_rule
request_headers:
# User admin
authorization: "basic YWRtaW46"
data:
name: test_rule3
metric_pattern: "disk.*"
archive_policy_name: low
status: 201
response_json_paths:
$.metric_pattern: disk.*
$.archive_policy_name: low
$.name: test_rule3
# Attempt to create an invalid policy rule
- name: create invalid archive policy rule
POST: /v1/archive_policy_rule
request_headers:
# User admin
authorization: "basic YWRtaW46"
data:
name: test_rule
metric_pattern: "disk.foo.*"
status: 400
- name: create archive policy rule with invalid archive policy
POST: /v1/archive_policy_rule
request_headers:
# User admin
authorization: "basic YWRtaW46"
accept: application/json
content-type: application/json
data:
name: test_rule
archive_policy_name: not-exists
metric_pattern: "disk.foo.*"
status: 400
response_json_paths:
$.code: 400
$.description.cause: "Archive policy does not exist"
$.description.detail: not-exists
- name: missing auth archive policy rule
POST: /v1/archive_policy_rule
request_headers:
content-type: application/json
data:
name: test_rule
metric_pattern: "disk.foo.*"
archive_policy_name: low
status: 403
- name: wrong content type
POST: /v1/archive_policy_rule
request_headers:
content-type: text/plain
# User admin
authorization: "basic YWRtaW46"
status: 415
response_strings:
- Unsupported Media Type
- name: wrong auth create rule
POST: /v1/archive_policy_rule
data:
name: test_rule_wrong_auth
metric_pattern: "disk.foo.*"
archive_policy_name: low
status: 403
- name: missing auth createrule
POST: /v1/archive_policy_rule
request_headers:
content-type: application/json
data:
name: test_rule_miss_auth
metric_pattern: "disk.foo.*"
archive_policy_name: low
status: 403
- name: bad request body
POST: /v1/archive_policy_rule
request_headers:
# User admin
authorization: "basic YWRtaW46"
data:
whaa: foobar
status: 400
response_strings:
- "Invalid input: extra keys not allowed"
# get an archive policy rules
- name: get archive policy rule
GET: /v1/archive_policy_rule
status: 200
response_json_paths:
$.[0].metric_pattern: disk.foo.*
$.[1].metric_pattern: disk.*
$.[2].metric_pattern: "*"
- name: get unknown archive policy rule
GET: /v1/archive_policy_rule/foo
status: 404
- name: delete used archive policy
DELETE: /v1/archive_policy/low
request_headers:
# User admin
authorization: "basic YWRtaW46"
status: 400
# rename an archive policy rule
- name: rename archive policy rule with missing name
PATCH: /v1/archive_policy_rule/test_rule3
request_headers:
# User admin
authorization: "basic YWRtaW46"
status: 400
- name: rename archive policy rule
PATCH: /v1/archive_policy_rule/test_rule3
request_headers:
# User admin
authorization: "basic YWRtaW46"
data:
name: test_rule3_renamed
status: 200
- name: get renamed archive policy rule
GET: /v1/archive_policy_rule/test_rule3_renamed
status: 200
response_json_paths:
$.metric_pattern: disk.*
$.archive_policy_name: low
$.name: test_rule3_renamed
- name: old archive policy rule doesn't exist
GET: /v1/archive_policy_rule/test_rule3
status: 404
- name: rename archive policy rule with existing name
PATCH: /v1/archive_policy_rule/test_rule2
request_headers:
# User admin
authorization: "basic YWRtaW46"
data:
name: test_rule3_renamed
status: 400
response_strings:
- 'Archive policy rule test_rule3_renamed already exists.'
# delete rule as non admin
- name: delete archive policy rule non admin
DELETE: /v1/archive_policy_rule/test_rule1
status: 403
# delete rule
- name: delete archive policy rule1
DELETE: /v1/archive_policy_rule/test_rule1
request_headers:
# User admin
authorization: "basic YWRtaW46"
status: 204
- name: delete archive policy rule2
DELETE: /v1/archive_policy_rule/test_rule2
request_headers:
# User admin
authorization: "basic YWRtaW46"
status: 204
- name: delete archive policy rule3
DELETE: /v1/archive_policy_rule/test_rule3_renamed
request_headers:
# User admin
authorization: "basic YWRtaW46"
status: 204
# delete again
- name: confirm delete archive policy rule
DELETE: /v1/archive_policy_rule/test_rule1
request_headers:
# User admin
authorization: "basic YWRtaW46"
status: 404
- name: delete missing archive policy rule utf8
DELETE: /v1/archive_policy_rule/%E2%9C%94%C3%A9%C3%B1%E2%98%83
request_headers:
# User admin
authorization: "basic YWRtaW46"
status: 404
response_strings:
- Archive policy rule ✔éñ☃ does not exist
|