Skip to content

Commit af51311

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Fix Query metrics tests (#1924)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 8b59579 commit af51311

8 files changed

+17
-17
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-03-22 19:28:37.393039",
8-
"spec_repo_commit": "b8f385dc"
7+
"regenerated": "2024-03-25 19:47:32.463334",
8+
"spec_repo_commit": "f9b6a1cc"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-03-22 19:28:37.408645",
13-
"spec_repo_commit": "b8f385dc"
12+
"regenerated": "2024-03-25 19:47:32.479878",
13+
"spec_repo_commit": "f9b6a1cc"
1414
}
1515
}
1616
}

examples/v2/metrics/QueryScalarData_3112571352.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
),
2929
),
3030
],
31-
_from=1671612804000,
31+
_from=1636625471000,
3232
queries=ScalarFormulaRequestQueries(
3333
[
3434
MetricsScalarQuery(
@@ -39,7 +39,7 @@
3939
),
4040
]
4141
),
42-
to=1671620004000,
42+
to=1636629071000,
4343
),
4444
type=ScalarFormulaRequestType.SCALAR_REQUEST,
4545
),

examples/v2/metrics/QueryTimeseriesData_301142940.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
),
2828
),
2929
],
30-
_from=1671612804000,
30+
_from=1636625471000,
3131
interval=5000,
3232
queries=TimeseriesFormulaRequestQueries(
3333
[
@@ -38,7 +38,7 @@
3838
),
3939
]
4040
),
41-
to=1671620004000,
41+
to=1636629071000,
4242
),
4343
type=TimeseriesFormulaRequestType.TIMESERIES_REQUEST,
4444
),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-12-21T11:14:01.142Z
1+
2024-03-25T19:28:00.854Z

tests/v2/cassettes/test_scenarios/test_scalar_cross_product_query_returns_ok_response.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
body: '{"data":{"attributes":{"formulas":[{"formula":"a","limit":{"count":10,"order":"desc"}}],"from":1671612804000,"queries":[{"aggregator":"avg","data_source":"metrics","name":"a","query":"avg:system.cpu.user{*}"}],"to":1671620004000},"type":"scalar_request"}}'
3+
body: '{"data":{"attributes":{"formulas":[{"formula":"a","limit":{"count":10,"order":"desc"}}],"from":1711391280000,"queries":[{"aggregator":"avg","data_source":"metrics","name":"a","query":"avg:system.cpu.user{*}"}],"to":1711394880000},"type":"scalar_request"}}'
44
headers:
55
accept:
66
- application/json
@@ -10,7 +10,7 @@ interactions:
1010
uri: https://api.datadoghq.com/api/v2/query/scalar
1111
response:
1212
body:
13-
string: '{"data":{"type":"scalar_response","attributes":{"columns":[{"name":"a","values":[5.173633659114822],"type":"number","meta":{"unit":[{"scale_factor":1.0,"id":17,"name":"percent","plural":"percent","family":"percentage","short_name":"%"},null]}}]}}}'
13+
string: '{"data":{"type":"scalar_response","attributes":{"columns":[{"values":[6.368151928283307],"name":"a","meta":{"unit":[{"short_name":"%","id":17,"plural":"percent","name":"percent","family":"percentage","scale_factor":1.0},null]},"type":"number"}]}}}'
1414
headers:
1515
content-type:
1616
- application/json
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-12-21T11:14:01.814Z
1+
2024-03-25T19:28:01.413Z

tests/v2/cassettes/test_scenarios/test_timeseries_cross_product_query_returns_ok_response.yaml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

tests/v2/features/metrics.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ Feature: Metrics
311311
Given a valid "appKeyAuth" key in the system
312312
And operation "QueryScalarData" enabled
313313
And new "QueryScalarData" request
314-
And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": 1671612804000, "queries": [{"aggregator": "avg", "data_source": "metrics", "query": "avg:system.cpu.user{*}", "name": "a"}], "to": 1671620004000}, "type": "scalar_request"}}
314+
And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "queries": [{"aggregator": "avg", "data_source": "metrics", "query": "avg:system.cpu.user{*}", "name": "a"}], "to": {{ timestamp('now') }}000}, "type": "scalar_request"}}
315315
When the request is sent
316316
Then the response status is 200 OK
317317
And the response "data.type" is equal to "scalar_response"
@@ -385,7 +385,7 @@ Feature: Metrics
385385
Given a valid "appKeyAuth" key in the system
386386
And operation "QueryTimeseriesData" enabled
387387
And new "QueryTimeseriesData" request
388-
And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": 1671612804000, "interval": 5000, "queries": [{"data_source": "metrics", "query": "avg:system.cpu.user{*}", "name": "a"}], "to": 1671620004000}, "type": "timeseries_request"}}
388+
And body with value {"data": {"attributes": {"formulas": [{"formula": "a", "limit": {"count": 10, "order": "desc"}}], "from": {{ timestamp('now - 1h') }}000, "interval": 5000, "queries": [{"data_source": "metrics", "query": "avg:system.cpu.user{*}", "name": "a"}], "to": {{ timestamp('now') }}000}, "type": "timeseries_request"}}
389389
When the request is sent
390390
Then the response status is 200 OK
391391
And the response "data.type" is equal to "timeseries_response"

0 commit comments

Comments
 (0)