Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
419 changes: 419 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions examples/v2/test-optimization/SearchFlakyTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Search flaky tests returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.searchFlakyTests"] = true;
const apiInstance = new v2.TestOptimizationApi(configuration);

const params: v2.TestOptimizationApiSearchFlakyTestsRequest = {
body: {
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",
},
},
};

apiInstance
.searchFlakyTests(params)
.then((data: v2.FlakyTestsSearchResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
40 changes: 40 additions & 0 deletions examples/v2/test-optimization/SearchFlakyTests_1224086727.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Search flaky tests returns "OK" response with pagination
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.searchFlakyTests"] = true;
const apiInstance = new v2.TestOptimizationApi(configuration);

const params: v2.TestOptimizationApiSearchFlakyTestsRequest = {
body: {
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",
},
},
};

(async () => {
try {
for await (const item of apiInstance.searchFlakyTestsWithPagination(
params
)) {
console.log(item);
}
} catch (error) {
console.error(error);
}
})();
38 changes: 38 additions & 0 deletions examples/v2/test-optimization/SearchFlakyTests_2665223746.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Search flaky tests returns "OK" response with filtered query
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.searchFlakyTests"] = true;
const apiInstance = new v2.TestOptimizationApi(configuration);

const params: v2.TestOptimizationApiSearchFlakyTestsRequest = {
body: {
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",
},
},
};

(async () => {
try {
for await (const item of apiInstance.searchFlakyTestsWithPagination(
params
)) {
console.log(item);
}
} catch (error) {
console.error(error);
}
})();
7 changes: 7 additions & 0 deletions features/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8419,6 +8419,13 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
},
"operationResponseType": "IncidentTeamResponse",
},
"v2.SearchFlakyTests": {
"body": {
"type": "FlakyTestsSearchRequest",
"format": "",
},
"operationResponseType": "FlakyTestsSearchResponse",
},
"v2.SendInvitations": {
"body": {
"type": "UserInvitationsRequest",
Expand Down
42 changes: 42 additions & 0 deletions features/v2/test_optimization.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@endpoint(test-optimization) @endpoint(test-optimization-v2)
Feature: Test Optimization
Search and manage flaky tests through Test Optimization. See the [Test
Optimization page](https://docs.datadoghq.com/tests/) for more
information.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "TestOptimization" API
And operation "SearchFlakyTests" enabled
And new "SearchFlakyTests" request

@generated @skip @team:DataDog/ci-app-backend
Scenario: Search flaky tests returns "Bad Request" response
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"}}
When the request is sent
Then the response status is 400 Bad Request

@skip @team:DataDog/ci-app-backend
Scenario: Search flaky tests returns "Bad Request" response with invalid limit
Given body with value {"data": {"attributes": {"filter": {"query": "*"}, "page": {"limit": 2000}, "sort": "fqn"}, "type": "search_flaky_tests_request"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/ci-app-backend
Scenario: Search flaky tests returns "OK" response
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"}}
When the request is sent
Then the response status is 200 OK

@replay-only @skip @skip-validation @team:DataDog/ci-app-backend @with-pagination
Scenario: Search flaky tests returns "OK" response with filtered query
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"}}
When the request with pagination is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/ci-app-backend @with-pagination
Scenario: Search flaky tests returns "OK" response with pagination
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"}}
When the request with pagination is sent
Then the response status is 200 OK
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3978,6 +3978,12 @@
"type": "idempotent"
}
},
"SearchFlakyTests": {
"tag": "Test Optimization",
"undo": {
"type": "safe"
}
},
"GetUsageApplicationSecurityMonitoring": {
"tag": "Usage Metering",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions packages/datadog-api-client-common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ export function createConfiguration(
"v2.getIncidentTeam": false,
"v2.listIncidentTeams": false,
"v2.updateIncidentTeam": false,
"v2.searchFlakyTests": false,
}
);
configuration.httpApi.zstdCompressorCallback = conf.zstdCompressorCallback;
Expand Down
Loading