Skip to content

Commit 91cea91

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 4d6f860 of spec repo
1 parent 62554b1 commit 91cea91

File tree

10 files changed

+418
-22
lines changed

10 files changed

+418
-22
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 147 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26392,9 +26392,18 @@ components:
2639226392
Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available.
2639326393
example:
2639426394
- commit_sha: abc123def456
26395+
policy_id: ftm_policy.quarantine.failure_rate
26396+
policy_meta:
26397+
config:
26398+
failure_rate: 0.1
26399+
required_runs: 100
26400+
failure_rate: 0.25
26401+
total_runs: 200
2639526402
status: quarantined
2639626403
timestamp: 1704067200000
2639726404
- commit_sha: ""
26405+
policy_id: unknown
26406+
policy_meta:
2639826407
status: new
2639926408
timestamp: 1703980800000
2640026409
items:
@@ -26464,6 +26473,11 @@ components:
2646426473
description: The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available.
2646526474
example: abc123def456
2646626475
type: string
26476+
policy_id:
26477+
$ref: "#/components/schemas/FlakyTestHistoryPolicyId"
26478+
policy_meta:
26479+
$ref: "#/components/schemas/FlakyTestHistoryPolicyMeta"
26480+
nullable: true
2646726481
status:
2646826482
description: The test status at this point in history.
2646926483
example: quarantined
@@ -26478,6 +26492,131 @@ components:
2647826492
- commit_sha
2647926493
- timestamp
2648026494
type: object
26495+
FlakyTestHistoryPolicyId:
26496+
description: The policy that triggered this status change.
26497+
enum:
26498+
- ftm_policy.manual
26499+
- ftm_policy.fixed
26500+
- ftm_policy.disable.failure_rate
26501+
- ftm_policy.disable.branch_flake
26502+
- ftm_policy.disable.days_active
26503+
- ftm_policy.quarantine.failure_rate
26504+
- ftm_policy.quarantine.branch_flake
26505+
- ftm_policy.quarantine.days_active
26506+
- unknown
26507+
example: ftm_policy.quarantine.failure_rate
26508+
nullable: false
26509+
type: string
26510+
x-enum-varnames:
26511+
- MANUAL
26512+
- FIXED
26513+
- DISABLE_FAILURE_RATE
26514+
- DISABLE_BRANCH_FLAKE
26515+
- DISABLE_DAYS_ACTIVE
26516+
- QUARANTINE_FAILURE_RATE
26517+
- QUARANTINE_BRANCH_FLAKE
26518+
- QUARANTINE_DAYS_ACTIVE
26519+
- UNKNOWN
26520+
FlakyTestHistoryPolicyMeta:
26521+
description: Metadata about the policy that triggered this status change.
26522+
properties:
26523+
branches:
26524+
description: Branches where the test was flaky at the time of the status change.
26525+
example: ["main", "develop"]
26526+
items:
26527+
type: string
26528+
nullable: true
26529+
type: array
26530+
config:
26531+
$ref: "#/components/schemas/FlakyTestHistoryPolicyMetaConfig"
26532+
nullable: true
26533+
days_active:
26534+
description: The number of days the test has been active at the time of the status change.
26535+
example: 15
26536+
format: int32
26537+
maximum: 2147483647
26538+
nullable: true
26539+
type: integer
26540+
days_without_flake:
26541+
description: The number of days since the test last exhibited flakiness.
26542+
example: 30
26543+
format: int32
26544+
maximum: 2147483647
26545+
nullable: true
26546+
type: integer
26547+
failure_rate:
26548+
description: The failure rate of the test at the time of the status change.
26549+
example: 0.25
26550+
format: double
26551+
maximum: 1
26552+
minimum: 0
26553+
nullable: true
26554+
type: number
26555+
state:
26556+
description: The previous state of the test.
26557+
example: quarantined
26558+
nullable: true
26559+
type: string
26560+
total_runs:
26561+
description: The total number of test runs at the time of the status change.
26562+
example: 200
26563+
format: int32
26564+
maximum: 2147483647
26565+
nullable: true
26566+
type: integer
26567+
type: object
26568+
FlakyTestHistoryPolicyMetaConfig:
26569+
description: Configuration parameters of the policy that triggered this status change.
26570+
properties:
26571+
branches:
26572+
description: The branches considered by the policy.
26573+
example: ["main"]
26574+
items:
26575+
type: string
26576+
nullable: true
26577+
type: array
26578+
days_active:
26579+
description: The number of days a test must have been active for the policy to trigger.
26580+
example: 30
26581+
format: int32
26582+
maximum: 2147483647
26583+
nullable: true
26584+
type: integer
26585+
failure_rate:
26586+
description: The failure rate threshold for the policy to trigger.
26587+
example: 0.7
26588+
format: double
26589+
maximum: 1
26590+
minimum: 0
26591+
nullable: true
26592+
type: number
26593+
forget_branches:
26594+
description: Branches excluded from the policy evaluation.
26595+
example: ["release"]
26596+
items:
26597+
type: string
26598+
nullable: true
26599+
type: array
26600+
required_runs:
26601+
description: The minimum number of test runs required for the policy to trigger.
26602+
example: 100
26603+
format: int32
26604+
maximum: 2147483647
26605+
nullable: true
26606+
type: integer
26607+
state:
26608+
description: The target state the policy transitions the test from.
26609+
example: quarantined
26610+
nullable: true
26611+
type: string
26612+
test_services:
26613+
description: Test services excluded from the policy evaluation.
26614+
example: ["my-service"]
26615+
items:
26616+
type: string
26617+
nullable: true
26618+
type: array
26619+
type: object
2648126620
FlakyTestPipelineStats:
2648226621
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.
2648326622
properties:
@@ -26557,6 +26696,14 @@ components:
2655726696
FlakyTestsSearchFilter:
2655826697
description: Search filter settings.
2655926698
properties:
26699+
include_history:
26700+
default: false
26701+
description: |-
26702+
Whether to include the status change history for each flaky test in the response.
26703+
When set to true, each test will include a `history` array with chronological status changes.
26704+
Defaults to false.
26705+
example: true
26706+
type: boolean
2656026707
query:
2656126708
default: "*"
2656226709
description: |-
@@ -26602,14 +26749,6 @@ components:
2660226749
properties:
2660326750
filter:
2660426751
$ref: "#/components/schemas/FlakyTestsSearchFilter"
26605-
include_history:
26606-
default: false
26607-
description: |-
26608-
Whether to include the status change history for each flaky test in the response.
26609-
When set to true, each test will include a `history` array with chronological status changes.
26610-
Defaults to false.
26611-
example: true
26612-
type: boolean
2661326752
page:
2661426753
$ref: "#/components/schemas/FlakyTestsSearchPageOptions"
2661526754
sort:

features/v2/test_optimization.feature

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Feature: Test Optimization
8585
Scenario: Search flaky tests returns "Bad Request" response
8686
Given operation "SearchFlakyTests" enabled
8787
And new "SearchFlakyTests" request
88-
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"}}
88+
And body with value {"data": {"attributes": {"filter": {"include_history": true, "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"}}
8989
When the request is sent
9090
Then the response status is 400 Bad Request
9191

@@ -101,7 +101,7 @@ Feature: Test Optimization
101101
Scenario: Search flaky tests returns "OK" response
102102
Given operation "SearchFlakyTests" enabled
103103
And new "SearchFlakyTests" request
104-
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"}}
104+
And body with value {"data": {"attributes": {"filter": {"include_history": true, "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"}}
105105
When the request is sent
106106
Then the response status is 200 OK
107107

@@ -117,19 +117,21 @@ Feature: Test Optimization
117117
Scenario: Search flaky tests returns "OK" response with history
118118
Given operation "SearchFlakyTests" enabled
119119
And new "SearchFlakyTests" request
120-
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"}}
120+
And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\"", "include_history": true}, "page": {"limit": 10}, "sort": "fqn"}, "type": "search_flaky_tests_request"}}
121121
When the request is sent
122122
Then the response status is 200 OK
123123
And the response "data[0].attributes" has field "history"
124124
And the response "data[0].attributes.history[0]" has field "status"
125125
And the response "data[0].attributes.history[0]" has field "commit_sha"
126126
And the response "data[0].attributes.history[0]" has field "timestamp"
127+
And the response "data[0].attributes.history[0]" has field "policy_id"
128+
And the response "data[0].attributes.history[0]" has field "policy_meta"
127129

128130
@generated @skip @team:DataDog/ci-app-backend @with-pagination
129131
Scenario: Search flaky tests returns "OK" response with pagination
130132
Given operation "SearchFlakyTests" enabled
131133
And new "SearchFlakyTests" request
132-
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"}}
134+
And body with value {"data": {"attributes": {"filter": {"include_history": true, "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"}}
133135
When the request with pagination is sent
134136
Then the response status is 200 OK
135137

services/test_optimization/src/v2/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ export { FlakyTest } from "./models/FlakyTest";
1212
export { FlakyTestAttributes } from "./models/FlakyTestAttributes";
1313
export { FlakyTestAttributesFlakyState } from "./models/FlakyTestAttributesFlakyState";
1414
export { FlakyTestHistory } from "./models/FlakyTestHistory";
15+
export { FlakyTestHistoryPolicyId } from "./models/FlakyTestHistoryPolicyId";
16+
export { FlakyTestHistoryPolicyMeta } from "./models/FlakyTestHistoryPolicyMeta";
17+
export { FlakyTestHistoryPolicyMetaConfig } from "./models/FlakyTestHistoryPolicyMetaConfig";
1518
export { FlakyTestPipelineStats } from "./models/FlakyTestPipelineStats";
1619
export { FlakyTestRunMetadata } from "./models/FlakyTestRunMetadata";
1720
export { FlakyTestsPagination } from "./models/FlakyTestsPagination";

services/test_optimization/src/v2/models/FlakyTestHistory.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { AttributeTypeMap } from "@datadog/datadog-api-client";
22

3+
import { FlakyTestHistoryPolicyId } from "./FlakyTestHistoryPolicyId";
4+
import { FlakyTestHistoryPolicyMeta } from "./FlakyTestHistoryPolicyMeta";
5+
36
/**
47
* A single history entry representing a status change for a flaky test.
58
*/
@@ -8,6 +11,14 @@ export class FlakyTestHistory {
811
* The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available.
912
*/
1013
"commitSha": string;
14+
/**
15+
* The policy that triggered this status change.
16+
*/
17+
"policyId"?: FlakyTestHistoryPolicyId;
18+
/**
19+
* Metadata about the policy that triggered this status change.
20+
*/
21+
"policyMeta"?: FlakyTestHistoryPolicyMeta;
1122
/**
1223
* The test status at this point in history.
1324
*/
@@ -36,6 +47,14 @@ export class FlakyTestHistory {
3647
type: "string",
3748
required: true,
3849
},
50+
policyId: {
51+
baseName: "policy_id",
52+
type: "FlakyTestHistoryPolicyId",
53+
},
54+
policyMeta: {
55+
baseName: "policy_meta",
56+
type: "FlakyTestHistoryPolicyMeta",
57+
},
3958
status: {
4059
baseName: "status",
4160
type: "string",
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { UnparsedObject } from "@datadog/datadog-api-client";
2+
3+
/**
4+
* The policy that triggered this status change.
5+
*/
6+
export type FlakyTestHistoryPolicyId =
7+
| typeof MANUAL
8+
| typeof FIXED
9+
| typeof DISABLE_FAILURE_RATE
10+
| typeof DISABLE_BRANCH_FLAKE
11+
| typeof DISABLE_DAYS_ACTIVE
12+
| typeof QUARANTINE_FAILURE_RATE
13+
| typeof QUARANTINE_BRANCH_FLAKE
14+
| typeof QUARANTINE_DAYS_ACTIVE
15+
| typeof UNKNOWN
16+
| UnparsedObject;
17+
export const MANUAL = "ftm_policy.manual";
18+
export const FIXED = "ftm_policy.fixed";
19+
export const DISABLE_FAILURE_RATE = "ftm_policy.disable.failure_rate";
20+
export const DISABLE_BRANCH_FLAKE = "ftm_policy.disable.branch_flake";
21+
export const DISABLE_DAYS_ACTIVE = "ftm_policy.disable.days_active";
22+
export const QUARANTINE_FAILURE_RATE = "ftm_policy.quarantine.failure_rate";
23+
export const QUARANTINE_BRANCH_FLAKE = "ftm_policy.quarantine.branch_flake";
24+
export const QUARANTINE_DAYS_ACTIVE = "ftm_policy.quarantine.days_active";
25+
export const UNKNOWN = "unknown";

0 commit comments

Comments
 (0)