Skip to content

Commit 621adb1

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

9 files changed

Lines changed: 398 additions & 9 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:

api/datadogV2/api_test_optimization.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ func (r *SearchFlakyTestsOptionalParameters) WithBody(body FlakyTestsSearchReque
3636

3737
// SearchFlakyTests Search flaky tests.
3838
// List endpoint returning flaky tests from Flaky Test Management. Results are paginated.
39+
//
40+
// The response includes comprehensive test information including:
41+
// - Test identification and metadata (module, suite, name)
42+
// - Flaky state and categorization
43+
// - First and last flake occurrences (timestamp, branch, commit SHA)
44+
// - Test execution statistics from the last 7 days (failure rate)
45+
// - Pipeline impact metrics (failed pipelines count, total lost time)
46+
// - Complete status change history (optional, ordered from most recent to oldest)
47+
//
48+
// Set `include_history` to `true` in the request to receive the status change history for each test.
49+
// History is disabled by default for better performance.
50+
//
51+
// Results support filtering by various facets including service, environment, repository, branch, and test state.
3952
func (a *TestOptimizationApi) SearchFlakyTests(ctx _context.Context, o ...SearchFlakyTestsOptionalParameters) (FlakyTestsSearchResponse, *_nethttp.Response, error) {
4053
var (
4154
localVarHTTPMethod = _nethttp.MethodPost

api/datadogV2/model_flaky_test_attributes.go

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ type FlakyTestAttributes struct {
2929
FlakyCategory datadog.NullableString `json:"flaky_category,omitempty"`
3030
// The current state of the flaky test.
3131
FlakyState *FlakyTestAttributesFlakyState `json:"flaky_state,omitempty"`
32+
// Chronological history of status changes for this flaky test, ordered from most recent to oldest.
33+
// Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available.
34+
History []FlakyTestHistory `json:"history,omitempty"`
3235
// The branch name where the test exhibited flakiness for the last time.
3336
LastFlakedBranch *string `json:"last_flaked_branch,omitempty"`
3437
// The commit SHA where the test exhibited flakiness for the last time.
@@ -314,6 +317,34 @@ func (o *FlakyTestAttributes) SetFlakyState(v FlakyTestAttributesFlakyState) {
314317
o.FlakyState = &v
315318
}
316319

320+
// GetHistory returns the History field value if set, zero value otherwise.
321+
func (o *FlakyTestAttributes) GetHistory() []FlakyTestHistory {
322+
if o == nil || o.History == nil {
323+
var ret []FlakyTestHistory
324+
return ret
325+
}
326+
return o.History
327+
}
328+
329+
// GetHistoryOk returns a tuple with the History field value if set, nil otherwise
330+
// and a boolean to check if the value has been set.
331+
func (o *FlakyTestAttributes) GetHistoryOk() (*[]FlakyTestHistory, bool) {
332+
if o == nil || o.History == nil {
333+
return nil, false
334+
}
335+
return &o.History, true
336+
}
337+
338+
// HasHistory returns a boolean if a field has been set.
339+
func (o *FlakyTestAttributes) HasHistory() bool {
340+
return o != nil && o.History != nil
341+
}
342+
343+
// SetHistory gets a reference to the given []FlakyTestHistory and assigns it to the History field.
344+
func (o *FlakyTestAttributes) SetHistory(v []FlakyTestHistory) {
345+
o.History = v
346+
}
347+
317348
// GetLastFlakedBranch returns the LastFlakedBranch field value if set, zero value otherwise.
318349
func (o *FlakyTestAttributes) GetLastFlakedBranch() string {
319350
if o == nil || o.LastFlakedBranch == nil {
@@ -635,6 +666,9 @@ func (o FlakyTestAttributes) MarshalJSON() ([]byte, error) {
635666
if o.FlakyState != nil {
636667
toSerialize["flaky_state"] = o.FlakyState
637668
}
669+
if o.History != nil {
670+
toSerialize["history"] = o.History
671+
}
638672
if o.LastFlakedBranch != nil {
639673
toSerialize["last_flaked_branch"] = o.LastFlakedBranch
640674
}
@@ -683,6 +717,7 @@ func (o *FlakyTestAttributes) UnmarshalJSON(bytes []byte) (err error) {
683717
FirstFlakedTs *int64 `json:"first_flaked_ts,omitempty"`
684718
FlakyCategory datadog.NullableString `json:"flaky_category,omitempty"`
685719
FlakyState *FlakyTestAttributesFlakyState `json:"flaky_state,omitempty"`
720+
History []FlakyTestHistory `json:"history,omitempty"`
686721
LastFlakedBranch *string `json:"last_flaked_branch,omitempty"`
687722
LastFlakedSha *string `json:"last_flaked_sha,omitempty"`
688723
LastFlakedTs *int64 `json:"last_flaked_ts,omitempty"`
@@ -699,7 +734,7 @@ func (o *FlakyTestAttributes) UnmarshalJSON(bytes []byte) (err error) {
699734
}
700735
additionalProperties := make(map[string]interface{})
701736
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
702-
datadog.DeleteKeys(additionalProperties, &[]string{"attempt_to_fix_id", "codeowners", "envs", "first_flaked_branch", "first_flaked_sha", "first_flaked_ts", "flaky_category", "flaky_state", "last_flaked_branch", "last_flaked_sha", "last_flaked_ts", "module", "name", "pipeline_stats", "services", "suite", "test_run_metadata", "test_stats"})
737+
datadog.DeleteKeys(additionalProperties, &[]string{"attempt_to_fix_id", "codeowners", "envs", "first_flaked_branch", "first_flaked_sha", "first_flaked_ts", "flaky_category", "flaky_state", "history", "last_flaked_branch", "last_flaked_sha", "last_flaked_ts", "module", "name", "pipeline_stats", "services", "suite", "test_run_metadata", "test_stats"})
703738
} else {
704739
return err
705740
}
@@ -717,6 +752,7 @@ func (o *FlakyTestAttributes) UnmarshalJSON(bytes []byte) (err error) {
717752
} else {
718753
o.FlakyState = all.FlakyState
719754
}
755+
o.History = all.History
720756
o.LastFlakedBranch = all.LastFlakedBranch
721757
o.LastFlakedSha = all.LastFlakedSha
722758
o.LastFlakedTs = all.LastFlakedTs
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
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+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// FlakyTestHistory A single history entry representing a status change for a flaky test.
14+
type FlakyTestHistory struct {
15+
// The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available.
16+
CommitSha string `json:"commit_sha"`
17+
// The test status at this point in history.
18+
Status string `json:"status"`
19+
// Unix timestamp in milliseconds when this status change occurred.
20+
Timestamp int64 `json:"timestamp"`
21+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
22+
UnparsedObject map[string]interface{} `json:"-"`
23+
AdditionalProperties map[string]interface{} `json:"-"`
24+
}
25+
26+
// NewFlakyTestHistory instantiates a new FlakyTestHistory object.
27+
// This constructor will assign default values to properties that have it defined,
28+
// and makes sure properties required by API are set, but the set of arguments
29+
// will change when the set of required properties is changed.
30+
func NewFlakyTestHistory(commitSha string, status string, timestamp int64) *FlakyTestHistory {
31+
this := FlakyTestHistory{}
32+
this.CommitSha = commitSha
33+
this.Status = status
34+
this.Timestamp = timestamp
35+
return &this
36+
}
37+
38+
// NewFlakyTestHistoryWithDefaults instantiates a new FlakyTestHistory object.
39+
// This constructor will only assign default values to properties that have it defined,
40+
// but it doesn't guarantee that properties required by API are set.
41+
func NewFlakyTestHistoryWithDefaults() *FlakyTestHistory {
42+
this := FlakyTestHistory{}
43+
return &this
44+
}
45+
46+
// GetCommitSha returns the CommitSha field value.
47+
func (o *FlakyTestHistory) GetCommitSha() string {
48+
if o == nil {
49+
var ret string
50+
return ret
51+
}
52+
return o.CommitSha
53+
}
54+
55+
// GetCommitShaOk returns a tuple with the CommitSha field value
56+
// and a boolean to check if the value has been set.
57+
func (o *FlakyTestHistory) GetCommitShaOk() (*string, bool) {
58+
if o == nil {
59+
return nil, false
60+
}
61+
return &o.CommitSha, true
62+
}
63+
64+
// SetCommitSha sets field value.
65+
func (o *FlakyTestHistory) SetCommitSha(v string) {
66+
o.CommitSha = v
67+
}
68+
69+
// GetStatus returns the Status field value.
70+
func (o *FlakyTestHistory) GetStatus() string {
71+
if o == nil {
72+
var ret string
73+
return ret
74+
}
75+
return o.Status
76+
}
77+
78+
// GetStatusOk returns a tuple with the Status field value
79+
// and a boolean to check if the value has been set.
80+
func (o *FlakyTestHistory) GetStatusOk() (*string, bool) {
81+
if o == nil {
82+
return nil, false
83+
}
84+
return &o.Status, true
85+
}
86+
87+
// SetStatus sets field value.
88+
func (o *FlakyTestHistory) SetStatus(v string) {
89+
o.Status = v
90+
}
91+
92+
// GetTimestamp returns the Timestamp field value.
93+
func (o *FlakyTestHistory) GetTimestamp() int64 {
94+
if o == nil {
95+
var ret int64
96+
return ret
97+
}
98+
return o.Timestamp
99+
}
100+
101+
// GetTimestampOk returns a tuple with the Timestamp field value
102+
// and a boolean to check if the value has been set.
103+
func (o *FlakyTestHistory) GetTimestampOk() (*int64, bool) {
104+
if o == nil {
105+
return nil, false
106+
}
107+
return &o.Timestamp, true
108+
}
109+
110+
// SetTimestamp sets field value.
111+
func (o *FlakyTestHistory) SetTimestamp(v int64) {
112+
o.Timestamp = v
113+
}
114+
115+
// MarshalJSON serializes the struct using spec logic.
116+
func (o FlakyTestHistory) MarshalJSON() ([]byte, error) {
117+
toSerialize := map[string]interface{}{}
118+
if o.UnparsedObject != nil {
119+
return datadog.Marshal(o.UnparsedObject)
120+
}
121+
toSerialize["commit_sha"] = o.CommitSha
122+
toSerialize["status"] = o.Status
123+
toSerialize["timestamp"] = o.Timestamp
124+
125+
for key, value := range o.AdditionalProperties {
126+
toSerialize[key] = value
127+
}
128+
return datadog.Marshal(toSerialize)
129+
}
130+
131+
// UnmarshalJSON deserializes the given payload.
132+
func (o *FlakyTestHistory) UnmarshalJSON(bytes []byte) (err error) {
133+
all := struct {
134+
CommitSha *string `json:"commit_sha"`
135+
Status *string `json:"status"`
136+
Timestamp *int64 `json:"timestamp"`
137+
}{}
138+
if err = datadog.Unmarshal(bytes, &all); err != nil {
139+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
140+
}
141+
if all.CommitSha == nil {
142+
return fmt.Errorf("required field commit_sha missing")
143+
}
144+
if all.Status == nil {
145+
return fmt.Errorf("required field status missing")
146+
}
147+
if all.Timestamp == nil {
148+
return fmt.Errorf("required field timestamp missing")
149+
}
150+
additionalProperties := make(map[string]interface{})
151+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
152+
datadog.DeleteKeys(additionalProperties, &[]string{"commit_sha", "status", "timestamp"})
153+
} else {
154+
return err
155+
}
156+
o.CommitSha = *all.CommitSha
157+
o.Status = *all.Status
158+
o.Timestamp = *all.Timestamp
159+
160+
if len(additionalProperties) > 0 {
161+
o.AdditionalProperties = additionalProperties
162+
}
163+
164+
return nil
165+
}

0 commit comments

Comments
 (0)