Skip to content

Commit d69a4e6

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Reduce flaking of metric tests by using a static metric (#1498)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent d417332 commit d69a4e6

10 files changed

+51
-51
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.4",
7-
"regenerated": "2023-06-01 14:05:06.473076",
8-
"spec_repo_commit": "c70ecd2f"
7+
"regenerated": "2023-06-05 14:46:50.084688",
8+
"spec_repo_commit": "060dc917"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-06-01 14:05:06.485472",
13-
"spec_repo_commit": "c70ecd2f"
12+
"regenerated": "2023-06-05 14:46:50.097095",
13+
"spec_repo_commit": "060dc917"
1414
}
1515
}
1616
}

examples/v2/metrics/ListActiveMetricConfigurations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
with ApiClient(configuration) as api_client:
1010
api_instance = MetricsApi(api_client)
1111
response = api_instance.list_active_metric_configurations(
12-
metric_name="ExampleMetric",
12+
metric_name="static_test_metric_donotdelete",
1313
)
1414

1515
print(response)

examples/v2/metrics/ListVolumesByMetricName.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
with ApiClient(configuration) as api_client:
1010
api_instance = MetricsApi(api_client)
1111
response = api_instance.list_volumes_by_metric_name(
12-
metric_name="ExampleMetric",
12+
metric_name="static_test_metric_donotdelete",
1313
)
1414

1515
print(response)

tests/v1/features/given.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@
159159
"tag": "Metrics",
160160
"operationId": "SubmitMetrics"
161161
},
162+
{
163+
"parameters": [
164+
{
165+
"name": "body",
166+
"value": "{\n \"series\": [\n {\n \"metric\": \"static_test_metric_donotdelete\",\n \"type\": \"gauge\",\n \"points\": [\n [\n {{ timestamp(\"now\") }},\n 1.1\n ]\n ],\n \"tags\": [\n \"test:static_test_metric_donotdelete\"\n ]\n }\n ]\n}\n"
167+
}
168+
],
169+
"step": "there is a valid \"metric_static\" in the system",
170+
"key": "metric_static",
171+
"tag": "Metrics",
172+
"operationId": "SubmitMetrics"
173+
},
162174
{
163175
"parameters": [
164176
{
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"series": [
3+
{
4+
"metric": "static_test_metric_donotdelete",
5+
"type": "gauge",
6+
"points": [
7+
[
8+
{{ timestamp("now") }},
9+
1.1
10+
]
11+
],
12+
"tags": [
13+
"test:static_test_metric_donotdelete"
14+
]
15+
}
16+
]
17+
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-09-01T12:00:27.800Z
1+
2023-06-05T14:44:05.398Z

tests/v2/cassettes/test_scenarios/test_list_active_tags_and_aggregations_returns_success_response.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
body: '{"series":[{"metric":"TestListactivetagsandaggregationsreturnsSuccessresponse1662033627","points":[[1662033627,1.1]],"tags":["test:ExampleSubmitmetricsreturnsPayloadacceptedresponse"],"type":"gauge"}]}'
3+
body: '{"series":[{"metric":"static_test_metric_donotdelete","points":[[1685976245,1.1]],"tags":["test:static_test_metric_donotdelete"],"type":"gauge"}]}'
44
headers:
55
accept:
66
- text/json, application/json
@@ -23,10 +23,10 @@ interactions:
2323
accept:
2424
- application/json
2525
method: GET
26-
uri: https://api.datadoghq.com/api/v2/metrics/TestListactivetagsandaggregationsreturnsSuccessresponse1662033627/active-configurations
26+
uri: https://api.datadoghq.com/api/v2/metrics/static_test_metric_donotdelete/active-configurations
2727
response:
2828
body:
29-
string: '{"data":{"type":"actively_queried_configurations","id":"TestListactivetagsandaggregationsreturnsSuccessresponse1662033627","attributes":{"active_tags":[],"active_aggregations":[]}}}
29+
string: '{"data":{"type":"actively_queried_configurations","id":"static_test_metric_donotdelete","attributes":{"active_tags":[],"active_aggregations":[]}}}
3030
3131
'
3232
headers:
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-05-12T11:28:32.184Z
1+
2023-06-02T15:15:47.326Z
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
body: '{"series":[{"metric":"TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912","points":[[1652354912,1.1]],"tags":["test:ExampleSubmitmetricsreturnsPayloadacceptedresponse"],"type":"gauge"}]}'
3+
body: '{"series":[{"metric":"static_test_metric_donotdelete","points":[[1685718947,1.1]],"tags":["test:static_test_metric_donotdelete"],"type":"gauge"}]}'
44
headers:
55
accept:
66
- text/json, application/json
@@ -17,52 +17,22 @@ interactions:
1717
status:
1818
code: 202
1919
message: Accepted
20-
- request:
21-
body: '{"data":{"attributes":{"metric_type":"gauge","tags":["app","datacenter","TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912"]},"id":"TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912","type":"manage_tags"}}'
22-
headers:
23-
accept:
24-
- application/json
25-
content-type:
26-
- application/json
27-
method: POST
28-
uri: https://api.datadoghq.com/api/v2/metrics/TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912/tags
29-
response:
30-
body:
31-
string: '{"data":{"type":"manage_tags","id":"TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912","attributes":{"tags":["TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912","app","datacenter"],"created_at":"2022-05-12T11:28:37.078639+00:00","modified_at":"2022-05-12T11:28:37.078639+00:00","metric_type":"gauge","aggregations":[{"space":"avg","time":"avg"}]}}}'
32-
headers:
33-
content-type:
34-
- application/json
35-
status:
36-
code: 201
37-
message: Created
3820
- request:
3921
body: null
4022
headers:
4123
accept:
4224
- application/json
4325
method: GET
44-
uri: https://api.datadoghq.com/api/v2/metrics/TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912/volumes
26+
uri: https://api.datadoghq.com/api/v2/metrics/static_test_metric_donotdelete/volumes
4527
response:
4628
body:
47-
string: '{"data":{"type":"metric_volumes","id":"TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912","attributes":{"indexed_volume":1,"ingested_volume":1}}}'
29+
string: '{"data":{"type":"metric_volumes","id":"static_test_metric_donotdelete","attributes":{"indexed_volume":1,"ingested_volume":1}}}
30+
31+
'
4832
headers:
4933
content-type:
5034
- application/json
5135
status:
5236
code: 200
5337
message: OK
54-
- request:
55-
body: null
56-
headers:
57-
accept:
58-
- '*/*'
59-
method: DELETE
60-
uri: https://api.datadoghq.com/api/v2/metrics/TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912/tags
61-
response:
62-
body:
63-
string: ''
64-
headers: {}
65-
status:
66-
code: 204
67-
message: No Content
6838
version: 1

tests/v2/features/metrics.feature

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,13 @@ Feature: Metrics
160160
@skip-validation @team:DataDog/metrics-experience
161161
Scenario: List active tags and aggregations returns "Success" response
162162
Given a valid "appKeyAuth" key in the system
163-
And there is a valid "metric" in the system
163+
And there is a valid "metric_static" in the system
164164
And new "ListActiveMetricConfigurations" request
165-
And request contains "metric_name" parameter with value "{{ unique_alnum }}"
165+
And request contains "metric_name" parameter with value "static_test_metric_donotdelete"
166166
When the request is sent
167167
Then the response status is 200 Success
168168
And the response "data.type" is equal to "actively_queried_configurations"
169+
And the response "data.id" is equal to "static_test_metric_donotdelete"
169170

170171
@generated @skip @team:DataDog/metrics-experience
171172
Scenario: List distinct metric volumes by metric name returns "Bad Request" response
@@ -186,13 +187,13 @@ Feature: Metrics
186187
@skip-validation @team:DataDog/metrics-experience
187188
Scenario: List distinct metric volumes by metric name returns "Success" response
188189
Given a valid "appKeyAuth" key in the system
189-
And there is a valid "metric" in the system
190-
And there is a valid "metric_tag_configuration" in the system
190+
And there is a valid "metric_static" in the system
191191
And new "ListVolumesByMetricName" request
192-
And request contains "metric_name" parameter with value "{{ unique_alnum }}"
192+
And request contains "metric_name" parameter with value "static_test_metric_donotdelete"
193193
When the request is sent
194194
Then the response status is 200 Success
195195
And the response "data.type" is equal to "metric_volumes"
196+
And the response "data.id" is equal to "static_test_metric_donotdelete"
196197

197198
@generated @skip @team:DataDog/metrics-experience
198199
Scenario: List tag configuration by name returns "Not Found" response

0 commit comments

Comments
 (0)