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
170 changes: 170 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61289,6 +61289,136 @@ components:
- name
- options
type: object
UpdateFlakyTestsRequest:
description: Request to update the state of multiple flaky tests.
properties:
data:
$ref: '#/components/schemas/UpdateFlakyTestsRequestData'
required:
- data
type: object
UpdateFlakyTestsRequestAttributes:
description: Attributes for updating flaky test states.
properties:
tests:
description: List of flaky tests to update.
items:
$ref: '#/components/schemas/UpdateFlakyTestsRequestTest'
type: array
required:
- tests
type: object
UpdateFlakyTestsRequestData:
description: The JSON:API data for updating flaky test states.
properties:
attributes:
$ref: '#/components/schemas/UpdateFlakyTestsRequestAttributes'
type:
$ref: '#/components/schemas/UpdateFlakyTestsRequestDataType'
required:
- type
- attributes
type: object
UpdateFlakyTestsRequestDataType:
description: The definition of `UpdateFlakyTestsRequestDataType` object.
enum:
- update_flaky_test_state_request
example: update_flaky_test_state_request
type: string
x-enum-varnames:
- UPDATE_FLAKY_TEST_STATE_REQUEST
UpdateFlakyTestsRequestTest:
description: Details of what tests to update and their new attributes.
properties:
id:
description: The ID of the flaky test. This is the same ID returned by the
Search flaky tests endpoint and corresponds to the test_fingerprint_fqn
field in test run events.
example: 4eb1887a8adb1847
type: string
new_state:
$ref: '#/components/schemas/UpdateFlakyTestsRequestTestNewState'
required:
- id
- new_state
type: object
UpdateFlakyTestsRequestTestNewState:
description: The new state to set for the flaky test.
enum:
- active
- quarantined
- disabled
- fixed
example: active
type: string
x-enum-varnames:
- ACTIVE
- QUARANTINED
- DISABLED
- FIXED
UpdateFlakyTestsResponse:
description: Response object for updating flaky test states.
properties:
data:
$ref: '#/components/schemas/UpdateFlakyTestsResponseData'
type: object
UpdateFlakyTestsResponseAttributes:
description: Attributes for the update flaky test state response.
properties:
has_errors:
description: '`True` if any errors occurred during the update operations.
`False` if all tests succeeded to be updated.'
example: true
type: boolean
results:
description: Results of the update operation for each test.
items:
$ref: '#/components/schemas/UpdateFlakyTestsResponseResult'
type: array
required:
- has_errors
- results
type: object
UpdateFlakyTestsResponseData:
description: Summary of the update operations. Tells whether a test succeeded
or failed to be updated.
properties:
attributes:
$ref: '#/components/schemas/UpdateFlakyTestsResponseAttributes'
id:
description: The ID of the response.
type: string
type:
$ref: '#/components/schemas/UpdateFlakyTestsResponseDataType'
type: object
UpdateFlakyTestsResponseDataType:
description: The definition of `UpdateFlakyTestsResponseDataType` object.
enum:
- update_flaky_test_state_response
type: string
x-enum-varnames:
- UPDATE_FLAKY_TEST_STATE_RESPONSE
UpdateFlakyTestsResponseResult:
description: Result of updating a single flaky test state.
properties:
error:
description: Error message if the update failed.
type: string
id:
description: The ID of the flaky test from the request. This is the same
ID returned by the Search flaky tests endpoint and corresponds to the
test_fingerprint_fqn field in test run events.
example: 4eb1887a8adb1847
type: string
success:
description: '`True` if the update was successful, `False` if there were
any errors.'
example: false
type: boolean
required:
- id
- success
type: object
UpdateOnCallNotificationRuleRequest:
description: A top-level wrapper for updating a notification rule for a user
example:
Expand Down Expand Up @@ -63638,6 +63768,8 @@ components:
teams_read: Read Teams data. A User with this permission can view Team
names, metadata, and which Users are on each Team.
test_optimization_read: View Test Optimization.
test_optimization_write: Update flaky tests from Flaky Tests Management
of Test Optimization.
timeseries_query: Query Timeseries data.
usage_read: View your organization's usage and usage attribution.
user_access_invite: Invite other users to your organization.
Expand Down Expand Up @@ -94850,6 +94982,44 @@ paths:
- incident_settings_write
x-unstable: '**Note**: This endpoint is deprecated. See the [Teams API endpoints](https://docs.datadoghq.com/api/latest/teams/).'
/api/v2/test/flaky-test-management/tests:
patch:
description: Update the state of multiple flaky tests in Flaky Test Management.
operationId: UpdateFlakyTests
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateFlakyTestsRequest'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateFlakyTestsResponse'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/NotAuthorizedResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- test_optimization_write
summary: Update flaky test states
tags:
- Test Optimization
x-codegen-request-body-name: body
x-permission:
operator: OR
permissions:
- test_optimization_write
x-unstable: '**Note**: This endpoint is in preview and may be subject to change.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
post:
description: List endpoint returning flaky tests from Flaky Test Management.
Results are paginated.
Expand Down
45 changes: 45 additions & 0 deletions examples/v2/test-optimization/UpdateFlakyTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Update flaky test states returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.TestOptimizationApi;
import com.datadog.api.client.v2.model.UpdateFlakyTestsRequest;
import com.datadog.api.client.v2.model.UpdateFlakyTestsRequestAttributes;
import com.datadog.api.client.v2.model.UpdateFlakyTestsRequestData;
import com.datadog.api.client.v2.model.UpdateFlakyTestsRequestDataType;
import com.datadog.api.client.v2.model.UpdateFlakyTestsRequestTest;
import com.datadog.api.client.v2.model.UpdateFlakyTestsRequestTestNewState;
import com.datadog.api.client.v2.model.UpdateFlakyTestsResponse;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.updateFlakyTests", true);
TestOptimizationApi apiInstance = new TestOptimizationApi(defaultClient);

UpdateFlakyTestsRequest body =
new UpdateFlakyTestsRequest()
.data(
new UpdateFlakyTestsRequestData()
.attributes(
new UpdateFlakyTestsRequestAttributes()
.tests(
Collections.singletonList(
new UpdateFlakyTestsRequestTest()
.id("4eb1887a8adb1847")
.newState(UpdateFlakyTestsRequestTestNewState.ACTIVE))))
.type(UpdateFlakyTestsRequestDataType.UPDATE_FLAKY_TEST_STATE_REQUEST));

try {
UpdateFlakyTestsResponse result = apiInstance.updateFlakyTests(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TestOptimizationApi#updateFlakyTests");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ public class ApiClient {
put("v2.listIncidentTeams", false);
put("v2.updateIncidentTeam", false);
put("v2.searchFlakyTests", false);
put("v2.updateFlakyTests", false);
}
};
protected static final java.util.logging.Logger logger =
Expand Down
Loading
Loading