Skip to content

Commit 5225e9a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 7923551 of spec repo (#2982)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent c87f49a commit 5225e9a

10 files changed

Lines changed: 326 additions & 6 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24023,6 +24023,22 @@ components:
2402324023
type: string
2402424024
flaky_state:
2402524025
$ref: '#/components/schemas/FlakyTestAttributesFlakyState'
24026+
history:
24027+
description: 'Chronological history of status changes for this flaky test,
24028+
ordered from most recent to oldest.
24029+
24030+
Includes state transitions like new -> quarantined -> fixed, along with
24031+
the associated commit SHA when available.'
24032+
example:
24033+
- commit_sha: abc123def456
24034+
status: quarantined
24035+
timestamp: 1704067200000
24036+
- commit_sha: ''
24037+
status: new
24038+
timestamp: 1703980800000
24039+
items:
24040+
$ref: '#/components/schemas/FlakyTestHistory'
24041+
type: array
2402624042
last_flaked_branch:
2402724043
description: The branch name where the test exhibited flakiness for the
2402824044
last time.
@@ -24107,6 +24123,29 @@ components:
2410724123
- FIXED
2410824124
- QUARANTINED
2410924125
- DISABLED
24126+
FlakyTestHistory:
24127+
description: A single history entry representing a status change for a flaky
24128+
test.
24129+
properties:
24130+
commit_sha:
24131+
description: The commit SHA associated with this status change. Will be
24132+
an empty string if the commit SHA is not available.
24133+
example: abc123def456
24134+
type: string
24135+
status:
24136+
description: The test status at this point in history.
24137+
example: quarantined
24138+
type: string
24139+
timestamp:
24140+
description: Unix timestamp in milliseconds when this status change occurred.
24141+
example: 1704067200000
24142+
format: int64
24143+
type: integer
24144+
required:
24145+
- status
24146+
- commit_sha
24147+
- timestamp
24148+
type: object
2411024149
FlakyTestPipelineStats:
2411124150
description: CI pipeline related statistics for the flaky test. This information
2411224151
is only available if test runs are associated with CI pipeline events from
@@ -24253,6 +24292,17 @@ components:
2425324292
properties:
2425424293
filter:
2425524294
$ref: '#/components/schemas/FlakyTestsSearchFilter'
24295+
include_history:
24296+
default: false
24297+
description: 'Whether to include the status change history for each flaky
24298+
test in the response.
24299+
24300+
When set to true, each test will include a `history` array with chronological
24301+
status changes.
24302+
24303+
Defaults to false.'
24304+
example: true
24305+
type: boolean
2425624306
page:
2425724307
$ref: '#/components/schemas/FlakyTestsSearchPageOptions'
2425824308
sort:
@@ -101085,8 +101135,33 @@ paths:
101085101135

101086101136
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
101087101137
post:
101088-
description: List endpoint returning flaky tests from Flaky Test Management.
101138+
description: 'List endpoint returning flaky tests from Flaky Test Management.
101089101139
Results are paginated.
101140+
101141+
101142+
The response includes comprehensive test information including:
101143+
101144+
- Test identification and metadata (module, suite, name)
101145+
101146+
- Flaky state and categorization
101147+
101148+
- First and last flake occurrences (timestamp, branch, commit SHA)
101149+
101150+
- Test execution statistics from the last 7 days (failure rate)
101151+
101152+
- Pipeline impact metrics (failed pipelines count, total lost time)
101153+
101154+
- Complete status change history (optional, ordered from most recent to oldest)
101155+
101156+
101157+
Set `include_history` to `true` in the request to receive the status change
101158+
history for each test.
101159+
101160+
History is disabled by default for better performance.
101161+
101162+
101163+
Results support filtering by various facets including service, environment,
101164+
repository, branch, and test state.'
101090101165
operationId: SearchFlakyTests
101091101166
requestBody:
101092101167
content:

examples/v2/test-optimization/SearchFlakyTests.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({
1313
query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
1414
}),
15+
include_history: true,
1516
page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({
1617
cursor: "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
1718
limit: 25,

examples/v2/test-optimization/SearchFlakyTests_1224086727.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({
1313
query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
1414
}),
15+
include_history: true,
1516
page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({
1617
cursor: "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
1718
limit: 25,
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Search flaky tests returns "OK" response with history
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.search_flaky_tests".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::TestOptimizationAPI.new
8+
9+
body = DatadogAPIClient::V2::FlakyTestsSearchRequest.new({
10+
data: DatadogAPIClient::V2::FlakyTestsSearchRequestData.new({
11+
attributes: DatadogAPIClient::V2::FlakyTestsSearchRequestAttributes.new({
12+
filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({
13+
query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
14+
}),
15+
page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({
16+
limit: 10,
17+
}),
18+
sort: DatadogAPIClient::V2::FlakyTestsSearchSort::FQN_ASCENDING,
19+
include_history: true,
20+
}),
21+
type: DatadogAPIClient::V2::FlakyTestsSearchRequestDataType::SEARCH_FLAKY_TESTS_REQUEST,
22+
}),
23+
})
24+
opts = {
25+
body: body,
26+
}
27+
p api_instance.search_flaky_tests(opts)

features/v2/test_optimization.feature

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Feature: Test Optimization
1313
Scenario: Search flaky tests returns "Bad Request" response
1414
Given operation "SearchFlakyTests" enabled
1515
And new "SearchFlakyTests" request
16-
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
16+
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
1717
When the request is sent
1818
Then the response status is 400 Bad Request
1919

@@ -29,7 +29,7 @@ Feature: Test Optimization
2929
Scenario: Search flaky tests returns "OK" response
3030
Given operation "SearchFlakyTests" enabled
3131
And new "SearchFlakyTests" request
32-
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
32+
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
3333
When the request is sent
3434
Then the response status is 200 OK
3535

@@ -41,11 +41,23 @@ Feature: Test Optimization
4141
When the request with pagination is sent
4242
Then the response status is 200 OK
4343

44+
@skip @team:DataDog/ci-app-backend
45+
Scenario: Search flaky tests returns "OK" response with history
46+
Given operation "SearchFlakyTests" enabled
47+
And new "SearchFlakyTests" request
48+
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"limit": 10}, "sort": "fqn", "include_history": true}, "type": "search_flaky_tests_request"}}
49+
When the request is sent
50+
Then the response status is 200 OK
51+
And the response "data[0].attributes" has field "history"
52+
And the response "data[0].attributes.history[0]" has field "status"
53+
And the response "data[0].attributes.history[0]" has field "commit_sha"
54+
And the response "data[0].attributes.history[0]" has field "timestamp"
55+
4456
@generated @skip @team:DataDog/ci-app-backend @with-pagination
4557
Scenario: Search flaky tests returns "OK" response with pagination
4658
Given operation "SearchFlakyTests" enabled
4759
And new "SearchFlakyTests" request
48-
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
60+
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}}
4961
When the request with pagination is sent
5062
Then the response status is 200 OK
5163

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2408,6 +2408,7 @@ def overrides
24082408
"v2.flaky_test" => "FlakyTest",
24092409
"v2.flaky_test_attributes" => "FlakyTestAttributes",
24102410
"v2.flaky_test_attributes_flaky_state" => "FlakyTestAttributesFlakyState",
2411+
"v2.flaky_test_history" => "FlakyTestHistory",
24112412
"v2.flaky_test_pipeline_stats" => "FlakyTestPipelineStats",
24122413
"v2.flaky_test_run_metadata" => "FlakyTestRunMetadata",
24132414
"v2.flaky_tests_pagination" => "FlakyTestsPagination",

lib/datadog_api_client/v2/api/test_optimization_api.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ def search_flaky_tests(opts = {})
3535
#
3636
# List endpoint returning flaky tests from Flaky Test Management. Results are paginated.
3737
#
38+
# The response includes comprehensive test information including:
39+
# - Test identification and metadata (module, suite, name)
40+
# - Flaky state and categorization
41+
# - First and last flake occurrences (timestamp, branch, commit SHA)
42+
# - Test execution statistics from the last 7 days (failure rate)
43+
# - Pipeline impact metrics (failed pipelines count, total lost time)
44+
# - Complete status change history (optional, ordered from most recent to oldest)
45+
#
46+
# Set `include_history` to `true` in the request to receive the status change history for each test.
47+
# History is disabled by default for better performance.
48+
#
49+
# Results support filtering by various facets including service, environment, repository, branch, and test state.
50+
#
3851
# @param opts [Hash] the optional parameters
3952
# @option opts [FlakyTestsSearchRequest] :body
4053
# @return [Array<(FlakyTestsSearchResponse, Integer, Hash)>] FlakyTestsSearchResponse data, response status code and response headers

lib/datadog_api_client/v2/models/flaky_test_attributes.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class FlakyTestAttributes
4848
# The current state of the flaky test.
4949
attr_accessor :flaky_state
5050

51+
# Chronological history of status changes for this flaky test, ordered from most recent to oldest.
52+
# Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available.
53+
attr_accessor :history
54+
5155
# The branch name where the test exhibited flakiness for the last time.
5256
attr_accessor :last_flaked_branch
5357

@@ -100,6 +104,7 @@ def self.attribute_map
100104
:'first_flaked_ts' => :'first_flaked_ts',
101105
:'flaky_category' => :'flaky_category',
102106
:'flaky_state' => :'flaky_state',
107+
:'history' => :'history',
103108
:'last_flaked_branch' => :'last_flaked_branch',
104109
:'last_flaked_sha' => :'last_flaked_sha',
105110
:'last_flaked_ts' => :'last_flaked_ts',
@@ -125,6 +130,7 @@ def self.openapi_types
125130
:'first_flaked_ts' => :'Integer',
126131
:'flaky_category' => :'String',
127132
:'flaky_state' => :'FlakyTestAttributesFlakyState',
133+
:'history' => :'Array<FlakyTestHistory>',
128134
:'last_flaked_branch' => :'String',
129135
:'last_flaked_sha' => :'String',
130136
:'last_flaked_ts' => :'Integer',
@@ -201,6 +207,12 @@ def initialize(attributes = {})
201207
self.flaky_state = attributes[:'flaky_state']
202208
end
203209

210+
if attributes.key?(:'history')
211+
if (value = attributes[:'history']).is_a?(Array)
212+
self.history = value
213+
end
214+
end
215+
204216
if attributes.key?(:'last_flaked_branch')
205217
self.last_flaked_branch = attributes[:'last_flaked_branch']
206218
end
@@ -278,6 +290,7 @@ def ==(o)
278290
first_flaked_ts == o.first_flaked_ts &&
279291
flaky_category == o.flaky_category &&
280292
flaky_state == o.flaky_state &&
293+
history == o.history &&
281294
last_flaked_branch == o.last_flaked_branch &&
282295
last_flaked_sha == o.last_flaked_sha &&
283296
last_flaked_ts == o.last_flaked_ts &&
@@ -295,7 +308,7 @@ def ==(o)
295308
# @return [Integer] Hash code
296309
# @!visibility private
297310
def hash
298-
[attempt_to_fix_id, codeowners, envs, first_flaked_branch, first_flaked_sha, first_flaked_ts, flaky_category, flaky_state, last_flaked_branch, last_flaked_sha, last_flaked_ts, _module, name, pipeline_stats, services, suite, test_run_metadata, test_stats, additional_properties].hash
311+
[attempt_to_fix_id, codeowners, envs, first_flaked_branch, first_flaked_sha, first_flaked_ts, flaky_category, flaky_state, history, last_flaked_branch, last_flaked_sha, last_flaked_ts, _module, name, pipeline_stats, services, suite, test_run_metadata, test_stats, additional_properties].hash
299312
end
300313
end
301314
end

0 commit comments

Comments
 (0)