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
77 changes: 77 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26975,6 +26975,83 @@ datadog\_api\_client.v2.model.update\_deployment\_rule\_params\_data\_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_request module
------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_request
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_request\_attributes module
------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_request_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_request\_data module
------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_request_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_request\_data\_type module
------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_request_data_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_request\_test module
------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_request_test
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_request\_test\_new\_state module
------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_request_test_new_state
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_response module
-------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_response\_attributes module
-------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_response_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_response\_data module
-------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_response_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_response\_data\_type module
-------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_response_data_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_flaky\_tests\_response\_result module
---------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_flaky_tests_response_result
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_on\_call\_notification\_rule\_request module
----------------------------------------------------------------------------------

Expand Down
34 changes: 34 additions & 0 deletions examples/v2/test-optimization/UpdateFlakyTests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""
Update flaky test states returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.test_optimization_api import TestOptimizationApi
from datadog_api_client.v2.model.update_flaky_tests_request import UpdateFlakyTestsRequest
from datadog_api_client.v2.model.update_flaky_tests_request_attributes import UpdateFlakyTestsRequestAttributes
from datadog_api_client.v2.model.update_flaky_tests_request_data import UpdateFlakyTestsRequestData
from datadog_api_client.v2.model.update_flaky_tests_request_data_type import UpdateFlakyTestsRequestDataType
from datadog_api_client.v2.model.update_flaky_tests_request_test import UpdateFlakyTestsRequestTest
from datadog_api_client.v2.model.update_flaky_tests_request_test_new_state import UpdateFlakyTestsRequestTestNewState

body = UpdateFlakyTestsRequest(
data=UpdateFlakyTestsRequestData(
attributes=UpdateFlakyTestsRequestAttributes(
tests=[
UpdateFlakyTestsRequestTest(
id="4eb1887a8adb1847",
new_state=UpdateFlakyTestsRequestTestNewState.ACTIVE,
),
],
),
type=UpdateFlakyTestsRequestDataType.UPDATE_FLAKY_TEST_STATE_REQUEST,
),
)

configuration = Configuration()
configuration.unstable_operations["update_flaky_tests"] = True
with ApiClient(configuration) as api_client:
api_instance = TestOptimizationApi(api_client)
response = api_instance.update_flaky_tests(body=body)

print(response)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ def __init__(
"v2.list_incident_teams": False,
"v2.update_incident_team": False,
"v2.search_flaky_tests": False,
"v2.update_flaky_tests": False,
}
)

Expand Down
38 changes: 38 additions & 0 deletions src/datadog_api_client/v2/api/test_optimization_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
UnsetType,
unset,
)
from datadog_api_client.v2.model.update_flaky_tests_response import UpdateFlakyTestsResponse
from datadog_api_client.v2.model.update_flaky_tests_request import UpdateFlakyTestsRequest
from datadog_api_client.v2.model.flaky_tests_search_response import FlakyTestsSearchResponse
from datadog_api_client.v2.model.flaky_tests_search_request import FlakyTestsSearchRequest
from datadog_api_client.v2.model.flaky_test import FlakyTest
Expand Down Expand Up @@ -48,6 +50,26 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._update_flaky_tests_endpoint = _Endpoint(
settings={
"response_type": (UpdateFlakyTestsResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/test/flaky-test-management/tests",
"operation_id": "update_flaky_tests",
"http_method": "PATCH",
"version": "v2",
},
params_map={
"body": {
"required": True,
"openapi_types": (UpdateFlakyTestsRequest,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

def search_flaky_tests(
self,
*,
Expand Down Expand Up @@ -96,3 +118,19 @@ def search_flaky_tests_with_pagination(
"kwargs": kwargs,
}
return endpoint.call_with_http_info_paginated(pagination)

def update_flaky_tests(
self,
body: UpdateFlakyTestsRequest,
) -> UpdateFlakyTestsResponse:
"""Update flaky test states.

Update the state of multiple flaky tests in Flaky Test Management.

:type body: UpdateFlakyTestsRequest
:rtype: UpdateFlakyTestsResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["body"] = body

return self._update_flaky_tests_endpoint.call_with_http_info(**kwargs)
Loading