Skip to content

Commit b323d97

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

11 files changed

Lines changed: 237 additions & 4 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.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const params: v2.TestOptimizationApiSearchFlakyTestsRequest = {
1515
filter: {
1616
query: `flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"`,
1717
},
18+
includeHistory: true,
1819
page: {
1920
cursor:
2021
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",

examples/v2/test-optimization/SearchFlakyTests_1224086727.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const params: v2.TestOptimizationApiSearchFlakyTestsRequest = {
1515
filter: {
1616
query: `flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"`,
1717
},
18+
includeHistory: true,
1819
page: {
1920
cursor:
2021
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Search flaky tests returns "OK" response with history
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.searchFlakyTests"] = true;
9+
const apiInstance = new v2.TestOptimizationApi(configuration);
10+
11+
const params: v2.TestOptimizationApiSearchFlakyTestsRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
filter: {
16+
query: `flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"`,
17+
},
18+
page: {
19+
limit: 10,
20+
},
21+
sort: "fqn",
22+
includeHistory: true,
23+
},
24+
type: "search_flaky_tests_request",
25+
},
26+
},
27+
};
28+
29+
apiInstance
30+
.searchFlakyTests(params)
31+
.then((data: v2.FlakyTestsSearchResponse) => {
32+
console.log(
33+
"API called successfully. Returned data: " + JSON.stringify(data)
34+
);
35+
})
36+
.catch((error: any) => console.error(error));

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

packages/datadog-api-client-v2/apis/TestOptimizationApi.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,19 @@ export class TestOptimizationApi {
276276

277277
/**
278278
* List endpoint returning flaky tests from Flaky Test Management. Results are paginated.
279+
*
280+
* The response includes comprehensive test information including:
281+
* - Test identification and metadata (module, suite, name)
282+
* - Flaky state and categorization
283+
* - First and last flake occurrences (timestamp, branch, commit SHA)
284+
* - Test execution statistics from the last 7 days (failure rate)
285+
* - Pipeline impact metrics (failed pipelines count, total lost time)
286+
* - Complete status change history (optional, ordered from most recent to oldest)
287+
*
288+
* Set `include_history` to `true` in the request to receive the status change history for each test.
289+
* History is disabled by default for better performance.
290+
*
291+
* Results support filtering by various facets including service, environment, repository, branch, and test state.
279292
* @param param The request object
280293
*/
281294
public searchFlakyTests(

packages/datadog-api-client-v2/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,6 +2557,7 @@ export { FindingVulnerabilityType } from "./models/FindingVulnerabilityType";
25572557
export { FlakyTest } from "./models/FlakyTest";
25582558
export { FlakyTestAttributes } from "./models/FlakyTestAttributes";
25592559
export { FlakyTestAttributesFlakyState } from "./models/FlakyTestAttributesFlakyState";
2560+
export { FlakyTestHistory } from "./models/FlakyTestHistory";
25602561
export { FlakyTestPipelineStats } from "./models/FlakyTestPipelineStats";
25612562
export { FlakyTestRunMetadata } from "./models/FlakyTestRunMetadata";
25622563
export { FlakyTestsPagination } from "./models/FlakyTestsPagination";

packages/datadog-api-client-v2/models/FlakyTestAttributes.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright 2020-Present Datadog, Inc.
55
*/
66
import { FlakyTestAttributesFlakyState } from "./FlakyTestAttributesFlakyState";
7+
import { FlakyTestHistory } from "./FlakyTestHistory";
78
import { FlakyTestPipelineStats } from "./FlakyTestPipelineStats";
89
import { FlakyTestRunMetadata } from "./FlakyTestRunMetadata";
910
import { FlakyTestStats } from "./FlakyTestStats";
@@ -49,6 +50,11 @@ export class FlakyTestAttributes {
4950
* The current state of the flaky test.
5051
*/
5152
"flakyState"?: FlakyTestAttributesFlakyState;
53+
/**
54+
* Chronological history of status changes for this flaky test, ordered from most recent to oldest.
55+
* Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available.
56+
*/
57+
"history"?: Array<FlakyTestHistory>;
5258
/**
5359
* The branch name where the test exhibited flakiness for the last time.
5460
*/
@@ -147,6 +153,10 @@ export class FlakyTestAttributes {
147153
baseName: "flaky_state",
148154
type: "FlakyTestAttributesFlakyState",
149155
},
156+
history: {
157+
baseName: "history",
158+
type: "Array<FlakyTestHistory>",
159+
},
150160
lastFlakedBranch: {
151161
baseName: "last_flaked_branch",
152162
type: "string",
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/**
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2020-Present Datadog, Inc.
5+
*/
6+
7+
import { AttributeTypeMap } from "../../datadog-api-client-common/util";
8+
9+
/**
10+
* A single history entry representing a status change for a flaky test.
11+
*/
12+
export class FlakyTestHistory {
13+
/**
14+
* The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available.
15+
*/
16+
"commitSha": string;
17+
/**
18+
* The test status at this point in history.
19+
*/
20+
"status": string;
21+
/**
22+
* Unix timestamp in milliseconds when this status change occurred.
23+
*/
24+
"timestamp": number;
25+
26+
/**
27+
* A container for additional, undeclared properties.
28+
* This is a holder for any undeclared properties as specified with
29+
* the 'additionalProperties' keyword in the OAS document.
30+
*/
31+
"additionalProperties"?: { [key: string]: any };
32+
33+
/**
34+
* @ignore
35+
*/
36+
"_unparsed"?: boolean;
37+
38+
/**
39+
* @ignore
40+
*/
41+
static readonly attributeTypeMap: AttributeTypeMap = {
42+
commitSha: {
43+
baseName: "commit_sha",
44+
type: "string",
45+
required: true,
46+
},
47+
status: {
48+
baseName: "status",
49+
type: "string",
50+
required: true,
51+
},
52+
timestamp: {
53+
baseName: "timestamp",
54+
type: "number",
55+
required: true,
56+
format: "int64",
57+
},
58+
additionalProperties: {
59+
baseName: "additionalProperties",
60+
type: "{ [key: string]: any; }",
61+
},
62+
};
63+
64+
/**
65+
* @ignore
66+
*/
67+
static getAttributeTypeMap(): AttributeTypeMap {
68+
return FlakyTestHistory.attributeTypeMap;
69+
}
70+
71+
public constructor() {}
72+
}

packages/datadog-api-client-v2/models/FlakyTestsSearchRequestAttributes.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export class FlakyTestsSearchRequestAttributes {
1717
* Search filter settings.
1818
*/
1919
"filter"?: FlakyTestsSearchFilter;
20+
/**
21+
* Whether to include the status change history for each flaky test in the response.
22+
* When set to true, each test will include a `history` array with chronological status changes.
23+
* Defaults to false.
24+
*/
25+
"includeHistory"?: boolean;
2026
/**
2127
* Pagination attributes for listing flaky tests.
2228
*/
@@ -46,6 +52,10 @@ export class FlakyTestsSearchRequestAttributes {
4652
baseName: "filter",
4753
type: "FlakyTestsSearchFilter",
4854
},
55+
includeHistory: {
56+
baseName: "include_history",
57+
type: "boolean",
58+
},
4959
page: {
5060
baseName: "page",
5161
type: "FlakyTestsSearchPageOptions",

0 commit comments

Comments
 (0)