Skip to content

Commit 44f06d7

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Documenting the new Flaky Test Management API endpoint for public beta (#2787)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent f40b6db commit 44f06d7

32 files changed

+1926
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 419 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@endpoint(test-optimization) @endpoint(test-optimization-v2)
2+
Feature: Test Optimization
3+
Search and manage flaky tests through Test Optimization. See the [Test
4+
Optimization page](https://docs.datadoghq.com/tests/) for more
5+
information.
6+
7+
Background:
8+
Given a valid "apiKeyAuth" key in the system
9+
And a valid "appKeyAuth" key in the system
10+
And an instance of "TestOptimization" API
11+
And operation "SearchFlakyTests" enabled
12+
And new "SearchFlakyTests" request
13+
14+
@generated @skip @team:DataDog/ci-app-backend
15+
Scenario: Search flaky tests returns "Bad Request" response
16+
Given 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"}}
17+
When the request is sent
18+
Then the response status is 400 Bad Request
19+
20+
@skip @team:DataDog/ci-app-backend
21+
Scenario: Search flaky tests returns "Bad Request" response with invalid limit
22+
Given body with value {"data": {"attributes": {"filter": {"query": "*"}, "page": {"limit": 2000}, "sort": "fqn"}, "type": "search_flaky_tests_request"}}
23+
When the request is sent
24+
Then the response status is 400 Bad Request
25+
26+
@generated @skip @team:DataDog/ci-app-backend
27+
Scenario: Search flaky tests returns "OK" response
28+
Given 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"}}
29+
When the request is sent
30+
Then the response status is 200 OK
31+
32+
@replay-only @skip @skip-validation @team:DataDog/ci-app-backend @with-pagination
33+
Scenario: Search flaky tests returns "OK" response with filtered query
34+
Given body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/cart-tracking\""}, "page": {"limit": 10}, "sort": "-last_flaked"}, "type": "search_flaky_tests_request"}}
35+
When the request with pagination is sent
36+
Then the response status is 200 OK
37+
38+
@generated @skip @team:DataDog/ci-app-backend @with-pagination
39+
Scenario: Search flaky tests returns "OK" response with pagination
40+
Given 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"}}
41+
When the request with pagination is sent
42+
Then the response status is 200 OK

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3978,6 +3978,12 @@
39783978
"type": "idempotent"
39793979
}
39803980
},
3981+
"SearchFlakyTests": {
3982+
"tag": "Test Optimization",
3983+
"undo": {
3984+
"type": "safe"
3985+
}
3986+
},
39813987
"GetUsageApplicationSecurityMonitoring": {
39823988
"tag": "Usage Metering",
39833989
"undo": {

packages/datadog-api-client/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ apiInstance
432432
| Synthetics | @datadog/datadog-api-client-synthetics | [README.md](../../services/synthetics/README.md) |
433433
| Tags | @datadog/datadog-api-client-tags | [README.md](../../services/tags/README.md) |
434434
| Teams | @datadog/datadog-api-client-teams | [README.md](../../services/teams/README.md) |
435+
| Test Optimization | @datadog/datadog-api-client-test-optimization | [README.md](../../services/test-optimization/README.md) |
435436
| Usage Metering | @datadog/datadog-api-client-usage-metering | [README.md](../../services/usage-metering/README.md) |
436437
| Users | @datadog/datadog-api-client-users | [README.md](../../services/users/README.md) |
437438
| Webhooks Integration | @datadog/datadog-api-client-webhooks-integration | [README.md](../../services/webhooks-integration/README.md) |

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8429,6 +8429,13 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
84298429
},
84308430
operationResponseType: "IncidentTeamResponse",
84318431
},
8432+
"TestOptimizationApi.V2.SearchFlakyTests": {
8433+
body: {
8434+
type: "FlakyTestsSearchRequest",
8435+
format: "",
8436+
},
8437+
operationResponseType: "FlakyTestsSearchResponse",
8438+
},
84328439
"UsersApi.V2.SendInvitations": {
84338440
body: {
84348441
type: "UserInvitationsRequest",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# @datadog/datadog-api-client-test-optimization
2+
3+
## Description
4+
5+
Search and manage flaky tests through Test Optimization. See the [Test Optimization page](https://docs.datadoghq.com/tests/) for more information.
6+
7+
## Navigation
8+
9+
- [Installation](#installation)
10+
- [Getting Started](#getting-started)
11+
12+
## Installation
13+
14+
```sh
15+
# NPM
16+
npm install @datadog/datadog-api-client-test-optimization
17+
# Yarn
18+
yarn add @datadog/datadog-api-client-test-optimization
19+
```
20+
21+
## Getting Started
22+
```ts
23+
import { createConfiguration } from "@datadog/datadog-api-client";
24+
import { TestOptimizationApiV2 } from "@datadog/datadog-api-client-test-optimization";
25+
import { v2 } from "@datadog/datadog-api-client-test-optimization";
26+
27+
const configuration = createConfiguration();
28+
// Enable unstable operations
29+
const configurationOpts = {
30+
unstableOperations: {
31+
"TestOptimizationApi.v2.searchFlakyTests": true
32+
}
33+
}
34+
35+
const configuration = createConfiguration(configurationOpts);
36+
const apiInstance = new TestOptimizationApiV2(configuration);
37+
const params = {/* parameters */};
38+
39+
apiInstance.searchFlakyTests(params).then((data) => {
40+
console.log("API called successfully. Returned data: " + JSON.stringify(data));
41+
}).catch((error) => {
42+
console.error("Error calling API: " + error);
43+
});
44+
```
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@datadog/datadog-api-client-test-optimization",
3+
"description": "",
4+
"author": "",
5+
"keywords": [
6+
"api",
7+
"fetch",
8+
"typescript"
9+
],
10+
"license": "Apache-2.0",
11+
"licenses": [
12+
{
13+
"type": "Apache-2.0",
14+
"url": "http://www.apache.org/licenses/LICENSE-2.0"
15+
}
16+
],
17+
"repository": {
18+
"type": "git",
19+
"url": "https://github.com/DataDog/datadog-api-client-typescript.git",
20+
"directory": "services/test-optimization"
21+
},
22+
"files": [
23+
"dist/**/*"
24+
],
25+
"main": "./dist/index.js",
26+
"typings": "./dist/index.d.ts",
27+
"scripts": {
28+
"prepack": "yarn workspace @datadog/datadog-api-client build && yarn build",
29+
"build": "yarn generate-version-files && tsc",
30+
"generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts"
31+
},
32+
"dependencies": {
33+
"@datadog/datadog-api-client": "^2.0.0-beta.0"
34+
},
35+
"devDependencies": {
36+
"typescript": "5.8.3"
37+
},
38+
"engines": {
39+
"node": ">=18.0.0"
40+
},
41+
"version": "0.0.1",
42+
"packageManager": "[email protected]"
43+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * as v2 from "./v2";
2+
3+
export { TestOptimizationApi as TestOptimizationApiV2 } from "./v2/TestOptimizationApi";

0 commit comments

Comments
 (0)