Skip to content

Commit

Permalink
Fix Query metrics tests (#1924)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Mar 26, 2024
1 parent 8b59579 commit af51311
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-03-22 19:28:37.393039",
"spec_repo_commit": "b8f385dc"
"regenerated": "2024-03-25 19:47:32.463334",
"spec_repo_commit": "f9b6a1cc"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-03-22 19:28:37.408645",
"spec_repo_commit": "b8f385dc"
"regenerated": "2024-03-25 19:47:32.479878",
"spec_repo_commit": "f9b6a1cc"
}
}
}
4 changes: 2 additions & 2 deletions examples/v2/metrics/QueryScalarData_3112571352.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
),
),
],
_from=1671612804000,
_from=1636625471000,
queries=ScalarFormulaRequestQueries(
[
MetricsScalarQuery(
Expand All @@ -39,7 +39,7 @@
),
]
),
to=1671620004000,
to=1636629071000,
),
type=ScalarFormulaRequestType.SCALAR_REQUEST,
),
Expand Down
4 changes: 2 additions & 2 deletions examples/v2/metrics/QueryTimeseriesData_301142940.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
),
),
],
_from=1671612804000,
_from=1636625471000,
interval=5000,
queries=TimeseriesFormulaRequestQueries(
[
Expand All @@ -38,7 +38,7 @@
),
]
),
to=1671620004000,
to=1636629071000,
),
type=TimeseriesFormulaRequestType.TIMESERIES_REQUEST,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-12-21T11:14:01.142Z
2024-03-25T19:28:00.854Z
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interactions:
- request:
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"}}'
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"}}'
headers:
accept:
- application/json
Expand All @@ -10,7 +10,7 @@ interactions:
uri: https://api.datadoghq.com/api/v2/query/scalar
response:
body:
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]}}]}}}'
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"}]}}}'
headers:
content-type:
- application/json
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-12-21T11:14:01.814Z
2024-03-25T19:28:01.413Z

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/v2/features/metrics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ Feature: Metrics
Given a valid "appKeyAuth" key in the system
And operation "QueryScalarData" enabled
And new "QueryScalarData" request
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"}}
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"}}
When the request is sent
Then the response status is 200 OK
And the response "data.type" is equal to "scalar_response"
Expand Down Expand Up @@ -385,7 +385,7 @@ Feature: Metrics
Given a valid "appKeyAuth" key in the system
And operation "QueryTimeseriesData" enabled
And new "QueryTimeseriesData" request
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"}}
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"}}
When the request is sent
Then the response status is 200 OK
And the response "data.type" is equal to "timeseries_response"
Expand Down

0 comments on commit af51311

Please sign in to comment.