Skip to content

Commit 9839b1e

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

File tree

11 files changed

+219
-4
lines changed

11 files changed

+219
-4
lines changed

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

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10049,6 +10049,13 @@ datadog\_api\_client.v2.model.flaky\_test\_attributes\_flaky\_state module
1004910049
:members:
1005010050
:show-inheritance:
1005110051

10052+
datadog\_api\_client.v2.model.flaky\_test\_history module
10053+
---------------------------------------------------------
10054+
10055+
.. automodule:: datadog_api_client.v2.model.flaky_test_history
10056+
:members:
10057+
:show-inheritance:
10058+
1005210059
datadog\_api\_client.v2.model.flaky\_test\_pipeline\_stats module
1005310060
-----------------------------------------------------------------
1005410061

examples/v2/test-optimization/SearchFlakyTests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
filter=FlakyTestsSearchFilter(
1919
query='flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
2020
),
21+
include_history=True,
2122
page=FlakyTestsSearchPageOptions(
2223
cursor="eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
2324
limit=25,

examples/v2/test-optimization/SearchFlakyTests_1224086727.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
filter=FlakyTestsSearchFilter(
1919
query='flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
2020
),
21+
include_history=True,
2122
page=FlakyTestsSearchPageOptions(
2223
cursor="eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
2324
limit=25,
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
Search flaky tests returns "OK" response with history
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.test_optimization_api import TestOptimizationApi
7+
from datadog_api_client.v2.model.flaky_tests_search_filter import FlakyTestsSearchFilter
8+
from datadog_api_client.v2.model.flaky_tests_search_page_options import FlakyTestsSearchPageOptions
9+
from datadog_api_client.v2.model.flaky_tests_search_request import FlakyTestsSearchRequest
10+
from datadog_api_client.v2.model.flaky_tests_search_request_attributes import FlakyTestsSearchRequestAttributes
11+
from datadog_api_client.v2.model.flaky_tests_search_request_data import FlakyTestsSearchRequestData
12+
from datadog_api_client.v2.model.flaky_tests_search_request_data_type import FlakyTestsSearchRequestDataType
13+
from datadog_api_client.v2.model.flaky_tests_search_sort import FlakyTestsSearchSort
14+
15+
body = FlakyTestsSearchRequest(
16+
data=FlakyTestsSearchRequestData(
17+
attributes=FlakyTestsSearchRequestAttributes(
18+
filter=FlakyTestsSearchFilter(
19+
query='flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
20+
),
21+
page=FlakyTestsSearchPageOptions(
22+
limit=10,
23+
),
24+
sort=FlakyTestsSearchSort.FQN_ASCENDING,
25+
include_history=True,
26+
),
27+
type=FlakyTestsSearchRequestDataType.SEARCH_FLAKY_TESTS_REQUEST,
28+
),
29+
)
30+
31+
configuration = Configuration()
32+
configuration.unstable_operations["search_flaky_tests"] = True
33+
with ApiClient(configuration) as api_client:
34+
api_instance = TestOptimizationApi(api_client)
35+
response = api_instance.search_flaky_tests(body=body)
36+
37+
print(response)

src/datadog_api_client/v2/api/test_optimization_api.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ def search_flaky_tests(
7979
8080
List endpoint returning flaky tests from Flaky Test Management. Results are paginated.
8181
82+
The response includes comprehensive test information including:
83+
84+
* Test identification and metadata (module, suite, name)
85+
* Flaky state and categorization
86+
* First and last flake occurrences (timestamp, branch, commit SHA)
87+
* Test execution statistics from the last 7 days (failure rate)
88+
* Pipeline impact metrics (failed pipelines count, total lost time)
89+
* Complete status change history (optional, ordered from most recent to oldest)
90+
91+
Set ``include_history`` to ``true`` in the request to receive the status change history for each test.
92+
History is disabled by default for better performance.
93+
94+
Results support filtering by various facets including service, environment, repository, branch, and test state.
95+
8296
:type body: FlakyTestsSearchRequest, optional
8397
:rtype: FlakyTestsSearchResponse
8498
"""

src/datadog_api_client/v2/model/flaky_test_attributes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
if TYPE_CHECKING:
1818
from datadog_api_client.v2.model.flaky_test_attributes_flaky_state import FlakyTestAttributesFlakyState
19+
from datadog_api_client.v2.model.flaky_test_history import FlakyTestHistory
1920
from datadog_api_client.v2.model.flaky_test_pipeline_stats import FlakyTestPipelineStats
2021
from datadog_api_client.v2.model.flaky_test_run_metadata import FlakyTestRunMetadata
2122
from datadog_api_client.v2.model.flaky_test_stats import FlakyTestStats
@@ -25,6 +26,7 @@ class FlakyTestAttributes(ModelNormal):
2526
@cached_property
2627
def openapi_types(_):
2728
from datadog_api_client.v2.model.flaky_test_attributes_flaky_state import FlakyTestAttributesFlakyState
29+
from datadog_api_client.v2.model.flaky_test_history import FlakyTestHistory
2830
from datadog_api_client.v2.model.flaky_test_pipeline_stats import FlakyTestPipelineStats
2931
from datadog_api_client.v2.model.flaky_test_run_metadata import FlakyTestRunMetadata
3032
from datadog_api_client.v2.model.flaky_test_stats import FlakyTestStats
@@ -38,6 +40,7 @@ def openapi_types(_):
3840
"first_flaked_ts": (int,),
3941
"flaky_category": (str, none_type),
4042
"flaky_state": (FlakyTestAttributesFlakyState,),
43+
"history": ([FlakyTestHistory],),
4144
"last_flaked_branch": (str,),
4245
"last_flaked_sha": (str,),
4346
"last_flaked_ts": (int,),
@@ -59,6 +62,7 @@ def openapi_types(_):
5962
"first_flaked_ts": "first_flaked_ts",
6063
"flaky_category": "flaky_category",
6164
"flaky_state": "flaky_state",
65+
"history": "history",
6266
"last_flaked_branch": "last_flaked_branch",
6367
"last_flaked_sha": "last_flaked_sha",
6468
"last_flaked_ts": "last_flaked_ts",
@@ -81,6 +85,7 @@ def __init__(
8185
first_flaked_ts: Union[int, UnsetType] = unset,
8286
flaky_category: Union[str, none_type, UnsetType] = unset,
8387
flaky_state: Union[FlakyTestAttributesFlakyState, UnsetType] = unset,
88+
history: Union[List[FlakyTestHistory], UnsetType] = unset,
8489
last_flaked_branch: Union[str, UnsetType] = unset,
8590
last_flaked_sha: Union[str, UnsetType] = unset,
8691
last_flaked_ts: Union[int, UnsetType] = unset,
@@ -123,6 +128,10 @@ def __init__(
123128
:param flaky_state: The current state of the flaky test.
124129
:type flaky_state: FlakyTestAttributesFlakyState, optional
125130
131+
:param history: Chronological history of status changes for this flaky test, ordered from most recent to oldest.
132+
Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available.
133+
:type history: [FlakyTestHistory], optional
134+
126135
:param last_flaked_branch: The branch name where the test exhibited flakiness for the last time.
127136
:type last_flaked_branch: str, optional
128137
@@ -178,6 +187,8 @@ def __init__(
178187
kwargs["flaky_category"] = flaky_category
179188
if flaky_state is not unset:
180189
kwargs["flaky_state"] = flaky_state
190+
if history is not unset:
191+
kwargs["history"] = history
181192
if last_flaked_branch is not unset:
182193
kwargs["last_flaked_branch"] = last_flaked_branch
183194
if last_flaked_sha is not unset:
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelNormal,
9+
cached_property,
10+
)
11+
12+
13+
class FlakyTestHistory(ModelNormal):
14+
@cached_property
15+
def openapi_types(_):
16+
return {
17+
"commit_sha": (str,),
18+
"status": (str,),
19+
"timestamp": (int,),
20+
}
21+
22+
attribute_map = {
23+
"commit_sha": "commit_sha",
24+
"status": "status",
25+
"timestamp": "timestamp",
26+
}
27+
28+
def __init__(self_, commit_sha: str, status: str, timestamp: int, **kwargs):
29+
"""
30+
A single history entry representing a status change for a flaky test.
31+
32+
:param commit_sha: The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available.
33+
:type commit_sha: str
34+
35+
:param status: The test status at this point in history.
36+
:type status: str
37+
38+
:param timestamp: Unix timestamp in milliseconds when this status change occurred.
39+
:type timestamp: int
40+
"""
41+
super().__init__(kwargs)
42+
43+
self_.commit_sha = commit_sha
44+
self_.status = status
45+
self_.timestamp = timestamp

src/datadog_api_client/v2/model/flaky_tests_search_request_attributes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,22 @@ def openapi_types(_):
2828

2929
return {
3030
"filter": (FlakyTestsSearchFilter,),
31+
"include_history": (bool,),
3132
"page": (FlakyTestsSearchPageOptions,),
3233
"sort": (FlakyTestsSearchSort,),
3334
}
3435

3536
attribute_map = {
3637
"filter": "filter",
38+
"include_history": "include_history",
3739
"page": "page",
3840
"sort": "sort",
3941
}
4042

4143
def __init__(
4244
self_,
4345
filter: Union[FlakyTestsSearchFilter, UnsetType] = unset,
46+
include_history: Union[bool, UnsetType] = unset,
4447
page: Union[FlakyTestsSearchPageOptions, UnsetType] = unset,
4548
sort: Union[FlakyTestsSearchSort, UnsetType] = unset,
4649
**kwargs,
@@ -51,6 +54,11 @@ def __init__(
5154
:param filter: Search filter settings.
5255
:type filter: FlakyTestsSearchFilter, optional
5356
57+
:param include_history: Whether to include the status change history for each flaky test in the response.
58+
When set to true, each test will include a ``history`` array with chronological status changes.
59+
Defaults to false.
60+
:type include_history: bool, optional
61+
5462
:param page: Pagination attributes for listing flaky tests.
5563
:type page: FlakyTestsSearchPageOptions, optional
5664
@@ -59,6 +67,8 @@ def __init__(
5967
"""
6068
if filter is not unset:
6169
kwargs["filter"] = filter
70+
if include_history is not unset:
71+
kwargs["include_history"] = include_history
6272
if page is not unset:
6373
kwargs["page"] = page
6474
if sort is not unset:

src/datadog_api_client/v2/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,7 @@
19711971
from datadog_api_client.v2.model.flaky_test import FlakyTest
19721972
from datadog_api_client.v2.model.flaky_test_attributes import FlakyTestAttributes
19731973
from datadog_api_client.v2.model.flaky_test_attributes_flaky_state import FlakyTestAttributesFlakyState
1974+
from datadog_api_client.v2.model.flaky_test_history import FlakyTestHistory
19741975
from datadog_api_client.v2.model.flaky_test_pipeline_stats import FlakyTestPipelineStats
19751976
from datadog_api_client.v2.model.flaky_test_run_metadata import FlakyTestRunMetadata
19761977
from datadog_api_client.v2.model.flaky_test_stats import FlakyTestStats
@@ -7431,6 +7432,7 @@
74317432
"FlakyTest",
74327433
"FlakyTestAttributes",
74337434
"FlakyTestAttributesFlakyState",
7435+
"FlakyTestHistory",
74347436
"FlakyTestPipelineStats",
74357437
"FlakyTestRunMetadata",
74367438
"FlakyTestStats",

0 commit comments

Comments
 (0)