Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 147 additions & 8 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26392,9 +26392,18 @@ components:
Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available.
example:
- commit_sha: abc123def456
policy_id: ftm_policy.quarantine.failure_rate
policy_meta:
config:
failure_rate: 0.1
required_runs: 100
failure_rate: 0.25
total_runs: 200
status: quarantined
timestamp: 1704067200000
- commit_sha: ""
policy_id: unknown
policy_meta:
status: new
timestamp: 1703980800000
items:
Expand Down Expand Up @@ -26464,6 +26473,11 @@ components:
description: The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available.
example: abc123def456
type: string
policy_id:
$ref: "#/components/schemas/FlakyTestHistoryPolicyId"
policy_meta:
$ref: "#/components/schemas/FlakyTestHistoryPolicyMeta"
nullable: true
status:
description: The test status at this point in history.
example: quarantined
Expand All @@ -26478,6 +26492,131 @@ components:
- commit_sha
- timestamp
type: object
FlakyTestHistoryPolicyId:
description: The policy that triggered this status change.
enum:
- ftm_policy.manual
- ftm_policy.fixed
- ftm_policy.disable.failure_rate
- ftm_policy.disable.branch_flake
- ftm_policy.disable.days_active
- ftm_policy.quarantine.failure_rate
- ftm_policy.quarantine.branch_flake
- ftm_policy.quarantine.days_active
- unknown
example: ftm_policy.quarantine.failure_rate
nullable: false
type: string
x-enum-varnames:
- MANUAL
- FIXED
- DISABLE_FAILURE_RATE
- DISABLE_BRANCH_FLAKE
- DISABLE_DAYS_ACTIVE
- QUARANTINE_FAILURE_RATE
- QUARANTINE_BRANCH_FLAKE
- QUARANTINE_DAYS_ACTIVE
- UNKNOWN
FlakyTestHistoryPolicyMeta:
description: Metadata about the policy that triggered this status change.
properties:
branches:
description: Branches where the test was flaky at the time of the status change.
example: ["main", "develop"]
items:
type: string
nullable: true
type: array
config:
$ref: "#/components/schemas/FlakyTestHistoryPolicyMetaConfig"
nullable: true
days_active:
description: The number of days the test has been active at the time of the status change.
example: 15
format: int32
maximum: 2147483647
nullable: true
type: integer
days_without_flake:
description: The number of days since the test last exhibited flakiness.
example: 30
format: int32
maximum: 2147483647
nullable: true
type: integer
failure_rate:
description: The failure rate of the test at the time of the status change.
example: 0.25
format: double
maximum: 1
minimum: 0
nullable: true
type: number
state:
description: The previous state of the test.
example: quarantined
nullable: true
type: string
total_runs:
description: The total number of test runs at the time of the status change.
example: 200
format: int32
maximum: 2147483647
nullable: true
type: integer
type: object
FlakyTestHistoryPolicyMetaConfig:
description: Configuration parameters of the policy that triggered this status change.
properties:
branches:
description: The branches considered by the policy.
example: ["main"]
items:
type: string
nullable: true
type: array
days_active:
description: The number of days a test must have been active for the policy to trigger.
example: 30
format: int32
maximum: 2147483647
nullable: true
type: integer
failure_rate:
description: The failure rate threshold for the policy to trigger.
example: 0.7
format: double
maximum: 1
minimum: 0
nullable: true
type: number
forget_branches:
description: Branches excluded from the policy evaluation.
example: ["release"]
items:
type: string
nullable: true
type: array
required_runs:
description: The minimum number of test runs required for the policy to trigger.
example: 100
format: int32
maximum: 2147483647
nullable: true
type: integer
state:
description: The target state the policy transitions the test from.
example: quarantined
nullable: true
type: string
test_services:
description: Test services excluded from the policy evaluation.
example: ["my-service"]
items:
type: string
nullable: true
type: array
type: object
FlakyTestPipelineStats:
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.
properties:
Expand Down Expand Up @@ -26557,6 +26696,14 @@ components:
FlakyTestsSearchFilter:
description: Search filter settings.
properties:
include_history:
default: false
description: |-
Whether to include the status change history for each flaky test in the response.
When set to true, each test will include a `history` array with chronological status changes.
Defaults to false.
example: true
type: boolean
query:
default: "*"
description: |-
Expand Down Expand Up @@ -26602,14 +26749,6 @@ components:
properties:
filter:
$ref: "#/components/schemas/FlakyTestsSearchFilter"
include_history:
default: false
description: |-
Whether to include the status change history for each flaky test in the response.
When set to true, each test will include a `history` array with chronological status changes.
Defaults to false.
example: true
type: boolean
page:
$ref: "#/components/schemas/FlakyTestsSearchPageOptions"
sort:
Expand Down
10 changes: 5 additions & 5 deletions examples/v2_test-optimization_SearchFlakyTests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ async fn main() {
.attributes(
FlakyTestsSearchRequestAttributes::new()
.filter(
FlakyTestsSearchFilter
::new().query(
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
),
FlakyTestsSearchFilter::new()
.include_history(true)
.query(
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
),
)
.include_history(true)
.page(
FlakyTestsSearchPageOptions::new()
.cursor(
Expand Down
10 changes: 5 additions & 5 deletions examples/v2_test-optimization_SearchFlakyTests_1224086727.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ async fn main() {
.attributes(
FlakyTestsSearchRequestAttributes::new()
.filter(
FlakyTestsSearchFilter
::new().query(
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
),
FlakyTestsSearchFilter::new()
.include_history(true)
.query(
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
),
)
.include_history(true)
.page(
FlakyTestsSearchPageOptions::new()
.cursor(
Expand Down
10 changes: 5 additions & 5 deletions examples/v2_test-optimization_SearchFlakyTests_209064879.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ async fn main() {
.attributes(
FlakyTestsSearchRequestAttributes::new()
.filter(
FlakyTestsSearchFilter
::new().query(
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
),
FlakyTestsSearchFilter::new()
.include_history(true)
.query(
r#"flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist""#.to_string(),
),
)
.include_history(true)
.page(FlakyTestsSearchPageOptions::new().limit(10))
.sort(FlakyTestsSearchSort::FQN_ASCENDING),
)
Expand Down
6 changes: 6 additions & 0 deletions src/datadogV2/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9274,6 +9274,12 @@ pub mod model_flaky_test_attributes_flaky_state;
pub use self::model_flaky_test_attributes_flaky_state::FlakyTestAttributesFlakyState;
pub mod model_flaky_test_history;
pub use self::model_flaky_test_history::FlakyTestHistory;
pub mod model_flaky_test_history_policy_id;
pub use self::model_flaky_test_history_policy_id::FlakyTestHistoryPolicyId;
pub mod model_flaky_test_history_policy_meta;
pub use self::model_flaky_test_history_policy_meta::FlakyTestHistoryPolicyMeta;
pub mod model_flaky_test_history_policy_meta_config;
pub use self::model_flaky_test_history_policy_meta_config::FlakyTestHistoryPolicyMetaConfig;
pub mod model_flaky_test_pipeline_stats;
pub use self::model_flaky_test_pipeline_stats::FlakyTestPipelineStats;
pub mod model_flaky_test_run_metadata;
Expand Down
47 changes: 47 additions & 0 deletions src/datadogV2/model/model_flaky_test_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ pub struct FlakyTestHistory {
/// The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available.
#[serde(rename = "commit_sha")]
pub commit_sha: String,
/// The policy that triggered this status change.
#[serde(rename = "policy_id")]
pub policy_id: Option<crate::datadogV2::model::FlakyTestHistoryPolicyId>,
/// Metadata about the policy that triggered this status change.
#[serde(rename = "policy_meta")]
pub policy_meta: Option<crate::datadogV2::model::FlakyTestHistoryPolicyMeta>,
/// The test status at this point in history.
#[serde(rename = "status")]
pub status: String,
Expand All @@ -31,13 +37,28 @@ impl FlakyTestHistory {
pub fn new(commit_sha: String, status: String, timestamp: i64) -> FlakyTestHistory {
FlakyTestHistory {
commit_sha,
policy_id: None,
policy_meta: None,
status,
timestamp,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}

pub fn policy_id(mut self, value: crate::datadogV2::model::FlakyTestHistoryPolicyId) -> Self {
self.policy_id = Some(value);
self
}

pub fn policy_meta(
mut self,
value: crate::datadogV2::model::FlakyTestHistoryPolicyMeta,
) -> Self {
self.policy_meta = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
Expand Down Expand Up @@ -65,6 +86,9 @@ impl<'de> Deserialize<'de> for FlakyTestHistory {
M: MapAccess<'a>,
{
let mut commit_sha: Option<String> = None;
let mut policy_id: Option<crate::datadogV2::model::FlakyTestHistoryPolicyId> = None;
let mut policy_meta: Option<crate::datadogV2::model::FlakyTestHistoryPolicyMeta> =
None;
let mut status: Option<String> = None;
let mut timestamp: Option<i64> = None;
let mut additional_properties: std::collections::BTreeMap<
Expand All @@ -78,6 +102,27 @@ impl<'de> Deserialize<'de> for FlakyTestHistory {
"commit_sha" => {
commit_sha = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"policy_id" => {
if v.is_null() {
continue;
}
policy_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _policy_id) = policy_id {
match _policy_id {
crate::datadogV2::model::FlakyTestHistoryPolicyId::UnparsedObject(_policy_id) => {
_unparsed = true;
},
_ => {}
}
}
}
"policy_meta" => {
if v.is_null() {
continue;
}
policy_meta =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"status" => {
status = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
Expand All @@ -97,6 +142,8 @@ impl<'de> Deserialize<'de> for FlakyTestHistory {

let content = FlakyTestHistory {
commit_sha,
policy_id,
policy_meta,
status,
timestamp,
additional_properties,
Expand Down
Loading
Loading