Skip to content

Commit ea5ea24

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

File tree

11 files changed

+1138
-51
lines changed

11 files changed

+1138
-51
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.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public static void main(String[] args) {
2727
new FlakyTestsSearchRequestAttributes()
2828
.filter(
2929
new FlakyTestsSearchFilter()
30+
.includeHistory(true)
3031
.query(
3132
"""
3233
flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"
3334
"""))
34-
.includeHistory(true)
3535
.page(
3636
new FlakyTestsSearchPageOptions()
3737
.cursor(

examples/v2/test-optimization/SearchFlakyTests_1224086727.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public static void main(String[] args) {
2727
new FlakyTestsSearchRequestAttributes()
2828
.filter(
2929
new FlakyTestsSearchFilter()
30+
.includeHistory(true)
3031
.query(
3132
"""
3233
flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"
3334
"""))
34-
.includeHistory(true)
3535
.page(
3636
new FlakyTestsSearchPageOptions()
3737
.cursor(

examples/v2/test-optimization/SearchFlakyTests_209064879.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ public static void main(String[] args) {
3030
.query(
3131
"""
3232
flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"
33-
"""))
33+
""")
34+
.includeHistory(true))
3435
.page(new FlakyTestsSearchPageOptions().limit(10L))
35-
.sort(FlakyTestsSearchSort.FQN_ASCENDING)
36-
.includeHistory(true))
36+
.sort(FlakyTestsSearchSort.FQN_ASCENDING))
3737
.type(FlakyTestsSearchRequestDataType.SEARCH_FLAKY_TESTS_REQUEST));
3838

3939
try {

src/main/java/com/datadog/api/client/v2/model/FlakyTestHistory.java

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
/** A single history entry representing a status change for a flaky test. */
2121
@JsonPropertyOrder({
2222
FlakyTestHistory.JSON_PROPERTY_COMMIT_SHA,
23+
FlakyTestHistory.JSON_PROPERTY_POLICY_ID,
24+
FlakyTestHistory.JSON_PROPERTY_POLICY_META,
2325
FlakyTestHistory.JSON_PROPERTY_STATUS,
2426
FlakyTestHistory.JSON_PROPERTY_TIMESTAMP
2527
})
@@ -30,6 +32,12 @@ public class FlakyTestHistory {
3032
public static final String JSON_PROPERTY_COMMIT_SHA = "commit_sha";
3133
private String commitSha;
3234

35+
public static final String JSON_PROPERTY_POLICY_ID = "policy_id";
36+
private FlakyTestHistoryPolicyId policyId;
37+
38+
public static final String JSON_PROPERTY_POLICY_META = "policy_meta";
39+
private FlakyTestHistoryPolicyMeta policyMeta;
40+
3341
public static final String JSON_PROPERTY_STATUS = "status";
3442
private String status;
3543

@@ -69,6 +77,53 @@ public void setCommitSha(String commitSha) {
6977
this.commitSha = commitSha;
7078
}
7179

80+
public FlakyTestHistory policyId(FlakyTestHistoryPolicyId policyId) {
81+
this.policyId = policyId;
82+
this.unparsed |= !policyId.isValid();
83+
return this;
84+
}
85+
86+
/**
87+
* The policy that triggered this status change.
88+
*
89+
* @return policyId
90+
*/
91+
@jakarta.annotation.Nullable
92+
@JsonProperty(JSON_PROPERTY_POLICY_ID)
93+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
94+
public FlakyTestHistoryPolicyId getPolicyId() {
95+
return policyId;
96+
}
97+
98+
public void setPolicyId(FlakyTestHistoryPolicyId policyId) {
99+
if (!policyId.isValid()) {
100+
this.unparsed = true;
101+
}
102+
this.policyId = policyId;
103+
}
104+
105+
public FlakyTestHistory policyMeta(FlakyTestHistoryPolicyMeta policyMeta) {
106+
this.policyMeta = policyMeta;
107+
this.unparsed |= policyMeta.unparsed;
108+
return this;
109+
}
110+
111+
/**
112+
* Metadata about the policy that triggered this status change.
113+
*
114+
* @return policyMeta
115+
*/
116+
@jakarta.annotation.Nullable
117+
@JsonProperty(JSON_PROPERTY_POLICY_META)
118+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
119+
public FlakyTestHistoryPolicyMeta getPolicyMeta() {
120+
return policyMeta;
121+
}
122+
123+
public void setPolicyMeta(FlakyTestHistoryPolicyMeta policyMeta) {
124+
this.policyMeta = policyMeta;
125+
}
126+
72127
public FlakyTestHistory status(String status) {
73128
this.status = status;
74129
return this;
@@ -166,21 +221,25 @@ public boolean equals(Object o) {
166221
}
167222
FlakyTestHistory flakyTestHistory = (FlakyTestHistory) o;
168223
return Objects.equals(this.commitSha, flakyTestHistory.commitSha)
224+
&& Objects.equals(this.policyId, flakyTestHistory.policyId)
225+
&& Objects.equals(this.policyMeta, flakyTestHistory.policyMeta)
169226
&& Objects.equals(this.status, flakyTestHistory.status)
170227
&& Objects.equals(this.timestamp, flakyTestHistory.timestamp)
171228
&& Objects.equals(this.additionalProperties, flakyTestHistory.additionalProperties);
172229
}
173230

174231
@Override
175232
public int hashCode() {
176-
return Objects.hash(commitSha, status, timestamp, additionalProperties);
233+
return Objects.hash(commitSha, policyId, policyMeta, status, timestamp, additionalProperties);
177234
}
178235

179236
@Override
180237
public String toString() {
181238
StringBuilder sb = new StringBuilder();
182239
sb.append("class FlakyTestHistory {\n");
183240
sb.append(" commitSha: ").append(toIndentedString(commitSha)).append("\n");
241+
sb.append(" policyId: ").append(toIndentedString(policyId)).append("\n");
242+
sb.append(" policyMeta: ").append(toIndentedString(policyMeta)).append("\n");
184243
sb.append(" status: ").append(toIndentedString(status)).append("\n");
185244
sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n");
186245
sb.append(" additionalProperties: ")

0 commit comments

Comments
 (0)