Skip to content

Commit 9d1a535

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update SearchFlakyTests endpoint documentation (#1457)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 3071bc2 commit 9d1a535

12 files changed

Lines changed: 750 additions & 47 deletions

.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.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ async fn main() {
1919
.attributes(
2020
FlakyTestsSearchRequestAttributes::new()
2121
.filter(
22-
FlakyTestsSearchFilter
23-
::new().query(
24-
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
25-
),
22+
FlakyTestsSearchFilter::new()
23+
.include_history(true)
24+
.query(
25+
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
26+
),
2627
)
27-
.include_history(true)
2828
.page(
2929
FlakyTestsSearchPageOptions::new()
3030
.cursor(

examples/v2_test-optimization_SearchFlakyTests_1224086727.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ async fn main() {
2121
.attributes(
2222
FlakyTestsSearchRequestAttributes::new()
2323
.filter(
24-
FlakyTestsSearchFilter
25-
::new().query(
26-
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
27-
),
24+
FlakyTestsSearchFilter::new()
25+
.include_history(true)
26+
.query(
27+
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
28+
),
2829
)
29-
.include_history(true)
3030
.page(
3131
FlakyTestsSearchPageOptions::new()
3232
.cursor(

examples/v2_test-optimization_SearchFlakyTests_209064879.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ async fn main() {
1919
.attributes(
2020
FlakyTestsSearchRequestAttributes::new()
2121
.filter(
22-
FlakyTestsSearchFilter
23-
::new().query(
24-
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
25-
),
22+
FlakyTestsSearchFilter::new()
23+
.include_history(true)
24+
.query(
25+
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
26+
),
2627
)
27-
.include_history(true)
2828
.page(FlakyTestsSearchPageOptions::new().limit(10))
2929
.sort(FlakyTestsSearchSort::FQN_ASCENDING),
3030
)

src/datadogV2/model/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9684,6 +9684,12 @@ pub mod model_flaky_test_attributes_flaky_state;
96849684
pub use self::model_flaky_test_attributes_flaky_state::FlakyTestAttributesFlakyState;
96859685
pub mod model_flaky_test_history;
96869686
pub use self::model_flaky_test_history::FlakyTestHistory;
9687+
pub mod model_flaky_test_history_policy_id;
9688+
pub use self::model_flaky_test_history_policy_id::FlakyTestHistoryPolicyId;
9689+
pub mod model_flaky_test_history_policy_meta;
9690+
pub use self::model_flaky_test_history_policy_meta::FlakyTestHistoryPolicyMeta;
9691+
pub mod model_flaky_test_history_policy_meta_config;
9692+
pub use self::model_flaky_test_history_policy_meta_config::FlakyTestHistoryPolicyMetaConfig;
96879693
pub mod model_flaky_test_pipeline_stats;
96889694
pub use self::model_flaky_test_pipeline_stats::FlakyTestPipelineStats;
96899695
pub mod model_flaky_test_run_metadata;

src/datadogV2/model/model_flaky_test_history.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ pub struct FlakyTestHistory {
1414
/// The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available.
1515
#[serde(rename = "commit_sha")]
1616
pub commit_sha: String,
17+
/// The policy that triggered this status change.
18+
#[serde(rename = "policy_id")]
19+
pub policy_id: Option<crate::datadogV2::model::FlakyTestHistoryPolicyId>,
20+
/// Metadata about the policy that triggered this status change.
21+
#[serde(rename = "policy_meta")]
22+
pub policy_meta: Option<crate::datadogV2::model::FlakyTestHistoryPolicyMeta>,
1723
/// The test status at this point in history.
1824
#[serde(rename = "status")]
1925
pub status: String,
@@ -31,13 +37,28 @@ impl FlakyTestHistory {
3137
pub fn new(commit_sha: String, status: String, timestamp: i64) -> FlakyTestHistory {
3238
FlakyTestHistory {
3339
commit_sha,
40+
policy_id: None,
41+
policy_meta: None,
3442
status,
3543
timestamp,
3644
additional_properties: std::collections::BTreeMap::new(),
3745
_unparsed: false,
3846
}
3947
}
4048

49+
pub fn policy_id(mut self, value: crate::datadogV2::model::FlakyTestHistoryPolicyId) -> Self {
50+
self.policy_id = Some(value);
51+
self
52+
}
53+
54+
pub fn policy_meta(
55+
mut self,
56+
value: crate::datadogV2::model::FlakyTestHistoryPolicyMeta,
57+
) -> Self {
58+
self.policy_meta = Some(value);
59+
self
60+
}
61+
4162
pub fn additional_properties(
4263
mut self,
4364
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -65,6 +86,9 @@ impl<'de> Deserialize<'de> for FlakyTestHistory {
6586
M: MapAccess<'a>,
6687
{
6788
let mut commit_sha: Option<String> = None;
89+
let mut policy_id: Option<crate::datadogV2::model::FlakyTestHistoryPolicyId> = None;
90+
let mut policy_meta: Option<crate::datadogV2::model::FlakyTestHistoryPolicyMeta> =
91+
None;
6892
let mut status: Option<String> = None;
6993
let mut timestamp: Option<i64> = None;
7094
let mut additional_properties: std::collections::BTreeMap<
@@ -78,6 +102,27 @@ impl<'de> Deserialize<'de> for FlakyTestHistory {
78102
"commit_sha" => {
79103
commit_sha = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
80104
}
105+
"policy_id" => {
106+
if v.is_null() {
107+
continue;
108+
}
109+
policy_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
110+
if let Some(ref _policy_id) = policy_id {
111+
match _policy_id {
112+
crate::datadogV2::model::FlakyTestHistoryPolicyId::UnparsedObject(_policy_id) => {
113+
_unparsed = true;
114+
},
115+
_ => {}
116+
}
117+
}
118+
}
119+
"policy_meta" => {
120+
if v.is_null() {
121+
continue;
122+
}
123+
policy_meta =
124+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
125+
}
81126
"status" => {
82127
status = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
83128
}
@@ -97,6 +142,8 @@ impl<'de> Deserialize<'de> for FlakyTestHistory {
97142

98143
let content = FlakyTestHistory {
99144
commit_sha,
145+
policy_id,
146+
policy_meta,
100147
status,
101148
timestamp,
102149
additional_properties,

0 commit comments

Comments
 (0)