This file is indexed.

/usr/lib/python3/dist-packages/gnocchi/tests/functional/gabbits/aggregation.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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
fixtures:
    - ConfigFixture

defaults:
  request_headers:
    content-type: application/json
    # User foobar
    authorization: "basic Zm9vYmFyOg=="

tests:
    - name: create archive policy
      desc: for later use
      POST: /v1/archive_policy
      request_headers:
        # User admin
        authorization: "basic YWRtaW46"
      data:
          name: low
          definition:
              - granularity: 1 second
              - granularity: 300 seconds
      status: 201

# Aggregation by metric ids

    - name: create metric 1
      POST: /v1/metric
      request_headers:
          content-type: application/json
      data:
        archive_policy_name: low
      status: 201

    - name: create metric 2
      POST: /v1/metric
      request_headers:
          content-type: application/json
      data:
        archive_policy_name: low
      status: 201

    - name: get metric list
      GET: /v1/metric

    - name: push measurements to metric 1
      POST: /v1/metric/$RESPONSE['$[0].id']/measures
      request_headers:
           content-type: application/json
      data:
          - timestamp: "2015-03-06T14:33:57"
            value: 43.1
          - timestamp: "2015-03-06T14:34:12"
            value: 12
      status: 202

    - name: push measurements to metric 2
      POST: /v1/metric/$HISTORY['get metric list'].$RESPONSE['$[1].id']/measures
      request_headers:
           content-type: application/json
      data:
          - timestamp: "2015-03-06T14:33:57"
            value: 3.1
          - timestamp: "2015-03-06T14:34:12"
            value: 2
          - timestamp: "2015-03-06T14:35:12"
            value: 5
      status: 202

    - name: get measure aggregates by granularity not float
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&metric=$HISTORY['get metric list'].$RESPONSE['$[1].id']&granularity=foobar
      status: 400

    - name: get measure aggregates with invalid uuids
      GET: /v1/aggregation/metric?metric=foobar
      status: 400

    - name: GET measure aggregates by granularity with refresh
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&metric=$HISTORY['get metric list'].$RESPONSE['$[1].id']&granularity=1&refresh=true
      response_json_paths:
        $:
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]

    - name: POST measure aggregates by granularity with refresh
      POST: /v1/aggregation/metric?granularity=1&refresh=true
      request_headers:
          content-type: application/json
      data:
        - $HISTORY['get metric list'].$RESPONSE['$[0].id']
        - $HISTORY['get metric list'].$RESPONSE['$[1].id']
      response_json_paths:
        $:
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]

    - name: get measure aggregates by granularity
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&metric=$HISTORY['get metric list'].$RESPONSE['$[1].id']&granularity=1
      poll:
          count: 10
          delay: 1
      response_json_paths:
        $:
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]

    - name: get measure aggregates by granularity with timestamps
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&metric=$HISTORY['get metric list'].$RESPONSE['$[1].id']&start=2015-03-06T15:33:57%2B01:00&stop=2015-03-06T15:34:00%2B01:00
      poll:
          count: 10
          delay: 1
      response_json_paths:
        $:
          - ['2015-03-06T14:30:00+00:00', 300.0, 15.05]
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]

    - name: get measure aggregates and reaggregate
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&metric=$HISTORY['get metric list'].$RESPONSE['$[1].id']&reaggregation=min
      poll:
          count: 10
          delay: 1
      response_json_paths:
        $:
          - ['2015-03-06T14:30:00+00:00', 300.0, 2.55]
          - ['2015-03-06T14:33:57+00:00', 1.0, 3.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 2.0]

    - name: get measure aggregates and resample
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&metric=$HISTORY['get metric list'].$RESPONSE['$[1].id']&granularity=1&resample=60
      response_json_paths:
        $:
          - ['2015-03-06T14:33:00+00:00', 60.0, 23.1]
          - ['2015-03-06T14:34:00+00:00', 60.0, 7.0]

    - name: get measure aggregates and operations
      POST: /v1/aggregates?granularity=1
      data:
        operations: "(aggregate mean (resample mean 60 (metric ($HISTORY['get metric list'].$RESPONSE['$[0].id'] mean) ($HISTORY['get metric list'].$RESPONSE['$[1].id'] mean))))"
      response_json_paths:
        $.measures.aggregated:
          - ['2015-03-06T14:33:00+00:00', 60.0, 23.1]
          - ['2015-03-06T14:34:00+00:00', 60.0, 7.0]
          - ['2015-03-06T14:35:00+00:00', 60.0, 5.0]

    - name: get measure aggregates with fill zero
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&metric=$HISTORY['get metric list'].$RESPONSE['$[1].id']&granularity=1&fill=0
      response_json_paths:
        $:
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]
          - ['2015-03-06T14:35:12+00:00', 1.0, 2.5]

    - name: get measure aggregates with fill null
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&metric=$HISTORY['get metric list'].$RESPONSE['$[1].id']&granularity=1&fill=null
      response_json_paths:
        $:
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]
          - ['2015-03-06T14:35:12+00:00', 1.0, 5.0]

    - name: get measure aggregates with fill all granularities
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&metric=$HISTORY['get metric list'].$RESPONSE['$[1].id']&fill=0
      response_json_paths:
        $:
          - ['2015-03-06T14:30:00+00:00', 300.0, 15.05]
          - ['2015-03-06T14:35:00+00:00', 300.0, 2.5]
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]
          - ['2015-03-06T14:35:12+00:00', 1.0, 2.5]

    - name: get measure aggregates with bad fill
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&metric=$HISTORY['get metric list'].$RESPONSE['$[1].id']&granularity=1&fill=asdf
      status: 400

    - name: get measure aggregates non existing granularity
      desc: https://github.com/gnocchixyz/gnocchi/issues/148
      GET: /v1/aggregation/metric?metric=$HISTORY['get metric list'].$RESPONSE['$[0].id']&granularity=42
      status: 404
      response_strings:
        - Aggregation method 'mean' at granularity '42.0' for metric

# Aggregation by resource and metric_name

    - name: post a resource
      POST: /v1/resource/generic
      data:
          id: bcd3441c-b5aa-4d1b-af9a-5a72322bb269
          metrics:
            agg_meter:
                archive_policy_name: low
      status: 201

    - name: post another resource
      POST: /v1/resource/generic
      data:
          id: 1b0a8345-b279-4cb8-bd7a-2cb83193624f
          metrics:
            agg_meter:
                archive_policy_name: low
      status: 201

    - name: push measurements to resource 1
      POST: /v1/resource/generic/bcd3441c-b5aa-4d1b-af9a-5a72322bb269/metric/agg_meter/measures
      data:
          - timestamp: "2015-03-06T14:33:57"
            value: 43.1
          - timestamp: "2015-03-06T14:34:12"
            value: 12
      status: 202

    - name: push measurements to resource 2
      POST: /v1/resource/generic/1b0a8345-b279-4cb8-bd7a-2cb83193624f/metric/agg_meter/measures
      data:
          - timestamp: "2015-03-06T14:33:57"
            value: 3.1
          - timestamp: "2015-03-06T14:34:12"
            value: 2
          - timestamp: "2015-03-06T14:35:12"
            value: 5
      status: 202

    - name: get measure aggregates by granularity from resources with refresh
      POST: /v1/aggregation/resource/generic/metric/agg_meter?granularity=1&refresh=true
      response_json_paths:
        $:
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]

    - name: get measure aggregates by granularity from resources
      POST: /v1/aggregation/resource/generic/metric/agg_meter?granularity=1
      poll:
          count: 10
          delay: 1
      response_json_paths:
        $:
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]

    - name: get measure aggregates by granularity from aggregates API
      POST: /v1/aggregates?granularity=1
      data:
        resource_type: generic
        search: {}
        operations: '(aggregate mean (metric agg_meter mean))'
      response_json_paths:
        $.measures.aggregated:
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]
          - ['2015-03-06T14:35:12+00:00', 1.0, 5.0]

    - name: get measure aggregates by granularity from resources and resample
      POST: /v1/aggregation/resource/generic/metric/agg_meter?granularity=1&resample=60
      response_json_paths:
        $:
          - ['2015-03-06T14:33:00+00:00', 60.0, 23.1]
          - ['2015-03-06T14:34:00+00:00', 60.0, 7.0]

    - name: get measure aggregates by granularity from aggregates API and resample
      POST: /v1/aggregates?granularity=1
      data:
        resource_type: generic
        search: {}
        operations: '(aggregate mean (resample mean 60 (metric agg_meter mean)))'
      response_json_paths:
        $.measures.aggregated:
          - ['2015-03-06T14:33:00+00:00', 60.0, 23.1]
          - ['2015-03-06T14:34:00+00:00', 60.0, 7.0]
          - ['2015-03-06T14:35:00+00:00', 60.0, 5.0]

    - name: get measure aggregates by granularity from resources and operations
      POST: /v1/aggregates?granularity=1
      data:
        resource_type: generic
        search: {}
        operations: '(aggregate mean (resample mean 60 (metric agg_meter mean)))'
      response_json_paths:
        $.measures.aggregated:
          - ['2015-03-06T14:33:00+00:00', 60.0, 23.1]
          - ['2015-03-06T14:34:00+00:00', 60.0, 7.0]
          - ['2015-03-06T14:35:00+00:00', 60.0, 5.0]

    - name: get measure aggregates by granularity from resources and bad resample
      POST: /v1/aggregation/resource/generic/metric/agg_meter?resample=abc
      status: 400

    - name: get measure aggregates by granularity from resources and resample no granularity
      POST: /v1/aggregation/resource/generic/metric/agg_meter?resample=60
      status: 400
      response_strings:
        - A granularity must be specified to resample

    - name: get measure aggregates by granularity with timestamps from resources
      POST: /v1/aggregation/resource/generic/metric/agg_meter?start=2015-03-06T15:33:57%2B01:00&stop=2015-03-06T15:34:00%2B01:00
      poll:
          count: 10
          delay: 1
      response_json_paths:
        $:
          - ['2015-03-06T14:30:00+00:00', 300.0, 15.05]
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]

    - name: get measure aggregates by granularity with timestamps from aggregates API
      POST: /v1/aggregates?start=2015-03-06T15:33:57%2B01:00&stop=2015-03-06T15:34:00%2B01:00
      data:
        resource_type: generic
        search: {}
        operations: '(aggregate mean (metric agg_meter mean))'
      poll:
          count: 10
          delay: 1
      response_json_paths:
        $.measures.aggregated:
          - ['2015-03-06T14:30:00+00:00', 300.0, 15.05]
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]

    - name: get measure aggregates by granularity from resources and reaggregate
      POST: /v1/aggregation/resource/generic/metric/agg_meter?granularity=1&reaggregation=min
      poll:
          count: 10
          delay: 1
      response_json_paths:
        $:
          - ['2015-03-06T14:33:57+00:00', 1.0, 3.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 2.0]

    - name: get measure aggregates from resources with fill zero
      POST: /v1/aggregation/resource/generic/metric/agg_meter?granularity=1&fill=0
      response_json_paths:
        $:
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]
          - ['2015-03-06T14:35:12+00:00', 1.0, 2.5]

    - name: get measure aggregates from aggregates API with fill zero
      POST: /v1/aggregates?granularity=1&fill=0
      data:
        resource_type: generic
        search: {}
        operations: '(aggregate mean (metric agg_meter mean))'
      response_json_paths:
        $.measures.aggregated:
          - ['2015-03-06T14:33:57+00:00', 1.0, 23.1]
          - ['2015-03-06T14:34:12+00:00', 1.0, 7.0]
          - ['2015-03-06T14:35:12+00:00', 1.0, 2.5]

# Some negative tests

    - name: get measure aggregates with wrong GET
      GET: /v1/aggregation/resource/generic/metric/agg_meter
      status: 405

    - name: get measure aggregates with wrong metric_name
      POST: /v1/aggregation/resource/generic/metric/notexists
      status: 200
      response_json_paths:
        $.`len`: 0

    - name: get measure aggregates with wrong resource
      POST: /v1/aggregation/resource/notexits/metric/agg_meter
      status: 404
      response_strings:
          - Resource type notexits does not exist

    - name: get measure aggregates with wrong path
      POST: /v1/aggregation/re/generic/metric/agg_meter
      status: 404

    - name: get measure aggregates with wrong path 2
      POST: /v1/aggregation/resource/generic/notexists/agg_meter
      status: 404

    - name: get measure aggregates with no resource name
      POST: /v1/aggregation/resource/generic/metric
      status: 405