Skip to content

Commit eba9d1c

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update SearchFlakyTests endpoint documentation (#3196)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 87532e1 commit eba9d1c

12 files changed

+692
-30
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 147 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26664,9 +26664,18 @@ components:
2666426664
Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available.
2666526665
example:
2666626666
- commit_sha: abc123def456
26667+
policy_id: ftm_policy.quarantine.failure_rate
26668+
policy_meta:
26669+
config:
26670+
failure_rate: 0.1
26671+
required_runs: 100
26672+
failure_rate: 0.25
26673+
total_runs: 200
2666726674
status: quarantined
2666826675
timestamp: 1704067200000
2666926676
- commit_sha: ""
26677+
policy_id: unknown
26678+
policy_meta:
2667026679
status: new
2667126680
timestamp: 1703980800000
2667226681
items:
@@ -26736,6 +26745,11 @@ components:
2673626745
description: The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available.
2673726746
example: abc123def456
2673826747
type: string
26748+
policy_id:
26749+
$ref: "#/components/schemas/FlakyTestHistoryPolicyId"
26750+
policy_meta:
26751+
$ref: "#/components/schemas/FlakyTestHistoryPolicyMeta"
26752+
nullable: true
2673926753
status:
2674026754
description: The test status at this point in history.
2674126755
example: quarantined
@@ -26750,6 +26764,131 @@ components:
2675026764
- commit_sha
2675126765
- timestamp
2675226766
type: object
26767+
FlakyTestHistoryPolicyId:
26768+
description: The policy that triggered this status change.
26769+
enum:
26770+
- ftm_policy.manual
26771+
- ftm_policy.fixed
26772+
- ftm_policy.disable.failure_rate
26773+
- ftm_policy.disable.branch_flake
26774+
- ftm_policy.disable.days_active
26775+
- ftm_policy.quarantine.failure_rate
26776+
- ftm_policy.quarantine.branch_flake
26777+
- ftm_policy.quarantine.days_active
26778+
- unknown
26779+
example: ftm_policy.quarantine.failure_rate
26780+
nullable: false
26781+
type: string
26782+
x-enum-varnames:
26783+
- MANUAL
26784+
- FIXED
26785+
- DISABLE_FAILURE_RATE
26786+
- DISABLE_BRANCH_FLAKE
26787+
- DISABLE_DAYS_ACTIVE
26788+
- QUARANTINE_FAILURE_RATE
26789+
- QUARANTINE_BRANCH_FLAKE
26790+
- QUARANTINE_DAYS_ACTIVE
26791+
- UNKNOWN
26792+
FlakyTestHistoryPolicyMeta:
26793+
description: Metadata about the policy that triggered this status change.
26794+
properties:
26795+
branches:
26796+
description: Branches where the test was flaky at the time of the status change.
26797+
example: ["main", "develop"]
26798+
items:
26799+
type: string
26800+
nullable: true
26801+
type: array
26802+
config:
26803+
$ref: "#/components/schemas/FlakyTestHistoryPolicyMetaConfig"
26804+
nullable: true
26805+
days_active:
26806+
description: The number of days the test has been active at the time of the status change.
26807+
example: 15
26808+
format: int32
26809+
maximum: 2147483647
26810+
nullable: true
26811+
type: integer
26812+
days_without_flake:
26813+
description: The number of days since the test last exhibited flakiness.
26814+
example: 30
26815+
format: int32
26816+
maximum: 2147483647
26817+
nullable: true
26818+
type: integer
26819+
failure_rate:
26820+
description: The failure rate of the test at the time of the status change.
26821+
example: 0.25
26822+
format: double
26823+
maximum: 1
26824+
minimum: 0
26825+
nullable: true
26826+
type: number
26827+
state:
26828+
description: The previous state of the test.
26829+
example: quarantined
26830+
nullable: true
26831+
type: string
26832+
total_runs:
26833+
description: The total number of test runs at the time of the status change.
26834+
example: 200
26835+
format: int32
26836+
maximum: 2147483647
26837+
nullable: true
26838+
type: integer
26839+
type: object
26840+
FlakyTestHistoryPolicyMetaConfig:
26841+
description: Configuration parameters of the policy that triggered this status change.
26842+
properties:
26843+
branches:
26844+
description: The branches considered by the policy.
26845+
example: ["main"]
26846+
items:
26847+
type: string
26848+
nullable: true
26849+
type: array
26850+
days_active:
26851+
description: The number of days a test must have been active for the policy to trigger.
26852+
example: 30
26853+
format: int32
26854+
maximum: 2147483647
26855+
nullable: true
26856+
type: integer
26857+
failure_rate:
26858+
description: The failure rate threshold for the policy to trigger.
26859+
example: 0.7
26860+
format: double
26861+
maximum: 1
26862+
minimum: 0
26863+
nullable: true
26864+
type: number
26865+
forget_branches:
26866+
description: Branches excluded from the policy evaluation.
26867+
example: ["release"]
26868+
items:
26869+
type: string
26870+
nullable: true
26871+
type: array
26872+
required_runs:
26873+
description: The minimum number of test runs required for the policy to trigger.
26874+
example: 100
26875+
format: int32
26876+
maximum: 2147483647
26877+
nullable: true
26878+
type: integer
26879+
state:
26880+
description: The target state the policy transitions the test from.
26881+
example: quarantined
26882+
nullable: true
26883+
type: string
26884+
test_services:
26885+
description: Test services excluded from the policy evaluation.
26886+
example: ["my-service"]
26887+
items:
26888+
type: string
26889+
nullable: true
26890+
type: array
26891+
type: object
2675326892
FlakyTestPipelineStats:
2675426893
description: CI pipeline related statistics for the flaky test. This information is only available if test runs are associated with CI pipeline events from CI Visibility.
2675526894
properties:
@@ -26829,6 +26968,14 @@ components:
2682926968
FlakyTestsSearchFilter:
2683026969
description: Search filter settings.
2683126970
properties:
26971+
include_history:
26972+
default: false
26973+
description: |-
26974+
Whether to include the status change history for each flaky test in the response.
26975+
When set to true, each test will include a `history` array with chronological status changes.
26976+
Defaults to false.
26977+
example: true
26978+
type: boolean
2683226979
query:
2683326980
default: "*"
2683426981
description: |-
@@ -26874,14 +27021,6 @@ components:
2687427021
properties:
2687527022
filter:
2687627023
$ref: "#/components/schemas/FlakyTestsSearchFilter"
26877-
include_history:
26878-
default: false
26879-
description: |-
26880-
Whether to include the status change history for each flaky test in the response.
26881-
When set to true, each test will include a `history` array with chronological status changes.
26882-
Defaults to false.
26883-
example: true
26884-
type: boolean
2688527024
page:
2688627025
$ref: "#/components/schemas/FlakyTestsSearchPageOptions"
2688727026
sort:

examples/v2/test-optimization/SearchFlakyTests.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
data: DatadogAPIClient::V2::FlakyTestsSearchRequestData.new({
1111
attributes: DatadogAPIClient::V2::FlakyTestsSearchRequestAttributes.new({
1212
filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({
13+
include_history: true,
1314
query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
1415
}),
15-
include_history: true,
1616
page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({
1717
cursor: "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
1818
limit: 25,

examples/v2/test-optimization/SearchFlakyTests_1224086727.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
data: DatadogAPIClient::V2::FlakyTestsSearchRequestData.new({
1111
attributes: DatadogAPIClient::V2::FlakyTestsSearchRequestAttributes.new({
1212
filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({
13+
include_history: true,
1314
query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
1415
}),
15-
include_history: true,
1616
page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({
1717
cursor: "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
1818
limit: 25,

examples/v2/test-optimization/SearchFlakyTests_209064879.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
attributes: DatadogAPIClient::V2::FlakyTestsSearchRequestAttributes.new({
1212
filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({
1313
query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
14+
include_history: true,
1415
}),
1516
page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({
1617
limit: 10,
1718
}),
1819
sort: DatadogAPIClient::V2::FlakyTestsSearchSort::FQN_ASCENDING,
19-
include_history: true,
2020
}),
2121
type: DatadogAPIClient::V2::FlakyTestsSearchRequestDataType::SEARCH_FLAKY_TESTS_REQUEST,
2222
}),

features/v2/test_optimization.feature

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Feature: Test Optimization
117117
Scenario: Search flaky tests returns "Bad Request" response
118118
Given operation "SearchFlakyTests" enabled
119119
And new "SearchFlakyTests" request
120-
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"}}
120+
And body with value {"data": {"attributes": {"filter": {"include_history": true, "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"}}
121121
When the request is sent
122122
Then the response status is 400 Bad Request
123123

@@ -133,7 +133,7 @@ Feature: Test Optimization
133133
Scenario: Search flaky tests returns "OK" response
134134
Given operation "SearchFlakyTests" enabled
135135
And new "SearchFlakyTests" request
136-
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"}}
136+
And body with value {"data": {"attributes": {"filter": {"include_history": true, "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"}}
137137
When the request is sent
138138
Then the response status is 200 OK
139139

@@ -149,19 +149,21 @@ Feature: Test Optimization
149149
Scenario: Search flaky tests returns "OK" response with history
150150
Given operation "SearchFlakyTests" enabled
151151
And new "SearchFlakyTests" request
152-
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"}}
152+
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\"", "include_history": true}, "page": {"limit": 10}, "sort": "fqn"}, "type": "search_flaky_tests_request"}}
153153
When the request is sent
154154
Then the response status is 200 OK
155155
And the response "data[0].attributes" has field "history"
156156
And the response "data[0].attributes.history[0]" has field "status"
157157
And the response "data[0].attributes.history[0]" has field "commit_sha"
158158
And the response "data[0].attributes.history[0]" has field "timestamp"
159+
And the response "data[0].attributes.history[0]" has field "policy_id"
160+
And the response "data[0].attributes.history[0]" has field "policy_meta"
159161

160162
@generated @skip @team:DataDog/ci-app-backend @with-pagination
161163
Scenario: Search flaky tests returns "OK" response with pagination
162164
Given operation "SearchFlakyTests" enabled
163165
And new "SearchFlakyTests" request
164-
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"}}
166+
And body with value {"data": {"attributes": {"filter": {"include_history": true, "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"}}
165167
When the request with pagination is sent
166168
Then the response status is 200 OK
167169

lib/datadog_api_client/inflector.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,6 +2691,9 @@ def overrides
26912691
"v2.flaky_test_attributes" => "FlakyTestAttributes",
26922692
"v2.flaky_test_attributes_flaky_state" => "FlakyTestAttributesFlakyState",
26932693
"v2.flaky_test_history" => "FlakyTestHistory",
2694+
"v2.flaky_test_history_policy_id" => "FlakyTestHistoryPolicyId",
2695+
"v2.flaky_test_history_policy_meta" => "FlakyTestHistoryPolicyMeta",
2696+
"v2.flaky_test_history_policy_meta_config" => "FlakyTestHistoryPolicyMetaConfig",
26942697
"v2.flaky_test_pipeline_stats" => "FlakyTestPipelineStats",
26952698
"v2.flaky_test_run_metadata" => "FlakyTestRunMetadata",
26962699
"v2.flaky_tests_pagination" => "FlakyTestsPagination",

lib/datadog_api_client/v2/models/flaky_test_history.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ class FlakyTestHistory
2424
# The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available.
2525
attr_reader :commit_sha
2626

27+
# The policy that triggered this status change.
28+
attr_accessor :policy_id
29+
30+
# Metadata about the policy that triggered this status change.
31+
attr_accessor :policy_meta
32+
2733
# The test status at this point in history.
2834
attr_reader :status
2935

@@ -37,6 +43,8 @@ class FlakyTestHistory
3743
def self.attribute_map
3844
{
3945
:'commit_sha' => :'commit_sha',
46+
:'policy_id' => :'policy_id',
47+
:'policy_meta' => :'policy_meta',
4048
:'status' => :'status',
4149
:'timestamp' => :'timestamp'
4250
}
@@ -47,6 +55,8 @@ def self.attribute_map
4755
def self.openapi_types
4856
{
4957
:'commit_sha' => :'String',
58+
:'policy_id' => :'FlakyTestHistoryPolicyId',
59+
:'policy_meta' => :'FlakyTestHistoryPolicyMeta',
5060
:'status' => :'String',
5161
:'timestamp' => :'Integer'
5262
}
@@ -74,6 +84,14 @@ def initialize(attributes = {})
7484
self.commit_sha = attributes[:'commit_sha']
7585
end
7686

87+
if attributes.key?(:'policy_id')
88+
self.policy_id = attributes[:'policy_id']
89+
end
90+
91+
if attributes.key?(:'policy_meta')
92+
self.policy_meta = attributes[:'policy_meta']
93+
end
94+
7795
if attributes.key?(:'status')
7896
self.status = attributes[:'status']
7997
end
@@ -150,6 +168,8 @@ def ==(o)
150168
return true if self.equal?(o)
151169
self.class == o.class &&
152170
commit_sha == o.commit_sha &&
171+
policy_id == o.policy_id &&
172+
policy_meta == o.policy_meta &&
153173
status == o.status &&
154174
timestamp == o.timestamp &&
155175
additional_properties == o.additional_properties
@@ -159,7 +179,7 @@ def ==(o)
159179
# @return [Integer] Hash code
160180
# @!visibility private
161181
def hash
162-
[commit_sha, status, timestamp, additional_properties].hash
182+
[commit_sha, policy_id, policy_meta, status, timestamp, additional_properties].hash
163183
end
164184
end
165185
end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# The policy that triggered this status change.
21+
class FlakyTestHistoryPolicyId
22+
include BaseEnumModel
23+
24+
MANUAL = "ftm_policy.manual".freeze
25+
FIXED = "ftm_policy.fixed".freeze
26+
DISABLE_FAILURE_RATE = "ftm_policy.disable.failure_rate".freeze
27+
DISABLE_BRANCH_FLAKE = "ftm_policy.disable.branch_flake".freeze
28+
DISABLE_DAYS_ACTIVE = "ftm_policy.disable.days_active".freeze
29+
QUARANTINE_FAILURE_RATE = "ftm_policy.quarantine.failure_rate".freeze
30+
QUARANTINE_BRANCH_FLAKE = "ftm_policy.quarantine.branch_flake".freeze
31+
QUARANTINE_DAYS_ACTIVE = "ftm_policy.quarantine.days_active".freeze
32+
UNKNOWN = "unknown".freeze
33+
end
34+
end

0 commit comments

Comments
 (0)