Skip to content

Commit

Permalink
Reduce flaking of metric tests by using a static metric (#1498)
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 committed Jun 5, 2023
1 parent d417332 commit d69a4e6
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 51 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.4",
"regenerated": "2023-06-01 14:05:06.473076",
"spec_repo_commit": "c70ecd2f"
"regenerated": "2023-06-05 14:46:50.084688",
"spec_repo_commit": "060dc917"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-06-01 14:05:06.485472",
"spec_repo_commit": "c70ecd2f"
"regenerated": "2023-06-05 14:46:50.097095",
"spec_repo_commit": "060dc917"
}
}
}
2 changes: 1 addition & 1 deletion examples/v2/metrics/ListActiveMetricConfigurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
with ApiClient(configuration) as api_client:
api_instance = MetricsApi(api_client)
response = api_instance.list_active_metric_configurations(
metric_name="ExampleMetric",
metric_name="static_test_metric_donotdelete",
)

print(response)
2 changes: 1 addition & 1 deletion examples/v2/metrics/ListVolumesByMetricName.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
with ApiClient(configuration) as api_client:
api_instance = MetricsApi(api_client)
response = api_instance.list_volumes_by_metric_name(
metric_name="ExampleMetric",
metric_name="static_test_metric_donotdelete",
)

print(response)
12 changes: 12 additions & 0 deletions tests/v1/features/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@
"tag": "Metrics",
"operationId": "SubmitMetrics"
},
{
"parameters": [
{
"name": "body",
"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"
}
],
"step": "there is a valid \"metric_static\" in the system",
"key": "metric_static",
"tag": "Metrics",
"operationId": "SubmitMetrics"
},
{
"parameters": [
{
Expand Down
17 changes: 17 additions & 0 deletions tests/v1/features/metric_payload_static.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"series": [
{
"metric": "static_test_metric_donotdelete",
"type": "gauge",
"points": [
[
{{ timestamp("now") }},
1.1
]
],
"tags": [
"test:static_test_metric_donotdelete"
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-09-01T12:00:27.800Z
2023-06-05T14:44:05.398Z
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interactions:
- request:
body: '{"series":[{"metric":"TestListactivetagsandaggregationsreturnsSuccessresponse1662033627","points":[[1662033627,1.1]],"tags":["test:ExampleSubmitmetricsreturnsPayloadacceptedresponse"],"type":"gauge"}]}'
body: '{"series":[{"metric":"static_test_metric_donotdelete","points":[[1685976245,1.1]],"tags":["test:static_test_metric_donotdelete"],"type":"gauge"}]}'
headers:
accept:
- text/json, application/json
Expand All @@ -23,10 +23,10 @@ interactions:
accept:
- application/json
method: GET
uri: https://api.datadoghq.com/api/v2/metrics/TestListactivetagsandaggregationsreturnsSuccessresponse1662033627/active-configurations
uri: https://api.datadoghq.com/api/v2/metrics/static_test_metric_donotdelete/active-configurations
response:
body:
string: '{"data":{"type":"actively_queried_configurations","id":"TestListactivetagsandaggregationsreturnsSuccessresponse1662033627","attributes":{"active_tags":[],"active_aggregations":[]}}}
string: '{"data":{"type":"actively_queried_configurations","id":"static_test_metric_donotdelete","attributes":{"active_tags":[],"active_aggregations":[]}}}
'
headers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-05-12T11:28:32.184Z
2023-06-02T15:15:47.326Z
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interactions:
- request:
body: '{"series":[{"metric":"TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912","points":[[1652354912,1.1]],"tags":["test:ExampleSubmitmetricsreturnsPayloadacceptedresponse"],"type":"gauge"}]}'
body: '{"series":[{"metric":"static_test_metric_donotdelete","points":[[1685718947,1.1]],"tags":["test:static_test_metric_donotdelete"],"type":"gauge"}]}'
headers:
accept:
- text/json, application/json
Expand All @@ -17,52 +17,22 @@ interactions:
status:
code: 202
message: Accepted
- request:
body: '{"data":{"attributes":{"metric_type":"gauge","tags":["app","datacenter","TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912"]},"id":"TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912","type":"manage_tags"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v2/metrics/TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912/tags
response:
body:
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"}]}}}'
headers:
content-type:
- application/json
status:
code: 201
message: Created
- request:
body: null
headers:
accept:
- application/json
method: GET
uri: https://api.datadoghq.com/api/v2/metrics/TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912/volumes
uri: https://api.datadoghq.com/api/v2/metrics/static_test_metric_donotdelete/volumes
response:
body:
string: '{"data":{"type":"metric_volumes","id":"TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912","attributes":{"indexed_volume":1,"ingested_volume":1}}}'
string: '{"data":{"type":"metric_volumes","id":"static_test_metric_donotdelete","attributes":{"indexed_volume":1,"ingested_volume":1}}}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: null
headers:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/metrics/TestListdistinctmetricvolumesbymetricnamereturnsSuccessresponse1652354912/tags
response:
body:
string: ''
headers: {}
status:
code: 204
message: No Content
version: 1
11 changes: 6 additions & 5 deletions tests/v2/features/metrics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,13 @@ Feature: Metrics
@skip-validation @team:DataDog/metrics-experience
Scenario: List active tags and aggregations returns "Success" response
Given a valid "appKeyAuth" key in the system
And there is a valid "metric" in the system
And there is a valid "metric_static" in the system
And new "ListActiveMetricConfigurations" request
And request contains "metric_name" parameter with value "{{ unique_alnum }}"
And request contains "metric_name" parameter with value "static_test_metric_donotdelete"
When the request is sent
Then the response status is 200 Success
And the response "data.type" is equal to "actively_queried_configurations"
And the response "data.id" is equal to "static_test_metric_donotdelete"

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

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

0 comments on commit d69a4e6

Please sign in to comment.