diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 12e9531700..3685ee4efd 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -25661,6 +25661,17 @@ components: FlakyTestsSearchFilter: description: Search filter settings. properties: + include_history: + default: false + description: 'Whether to include the status change history for each flaky + test in the response. + + When set to true, each test will include a ''history'' array with chronological + status changes. + + Defaults to false.' + example: true + type: boolean query: default: '*' description: 'Search query following log syntax used to filter flaky tests, @@ -25716,17 +25727,6 @@ components: properties: filter: $ref: '#/components/schemas/FlakyTestsSearchFilter' - include_history: - default: false - description: 'Whether to include the status change history for each flaky - test in the response. - - When set to true, each test will include a `history` array with chronological - status changes. - - Defaults to false.' - example: true - type: boolean page: $ref: '#/components/schemas/FlakyTestsSearchPageOptions' sort: diff --git a/examples/v2/test-optimization/SearchFlakyTests.py b/examples/v2/test-optimization/SearchFlakyTests.py index d7833df58c..4911424fda 100644 --- a/examples/v2/test-optimization/SearchFlakyTests.py +++ b/examples/v2/test-optimization/SearchFlakyTests.py @@ -16,9 +16,9 @@ data=FlakyTestsSearchRequestData( attributes=FlakyTestsSearchRequestAttributes( filter=FlakyTestsSearchFilter( + include_history=True, query='flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"', ), - include_history=True, page=FlakyTestsSearchPageOptions( cursor="eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", limit=25, diff --git a/examples/v2/test-optimization/SearchFlakyTests_1224086727.py b/examples/v2/test-optimization/SearchFlakyTests_1224086727.py index d5e4417960..dba5c0e048 100644 --- a/examples/v2/test-optimization/SearchFlakyTests_1224086727.py +++ b/examples/v2/test-optimization/SearchFlakyTests_1224086727.py @@ -16,9 +16,9 @@ data=FlakyTestsSearchRequestData( attributes=FlakyTestsSearchRequestAttributes( filter=FlakyTestsSearchFilter( + include_history=True, query='flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"', ), - include_history=True, page=FlakyTestsSearchPageOptions( cursor="eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", limit=25, diff --git a/examples/v2/test-optimization/SearchFlakyTests_209064879.py b/examples/v2/test-optimization/SearchFlakyTests_209064879.py index a5efd23231..ea3e22a17b 100644 --- a/examples/v2/test-optimization/SearchFlakyTests_209064879.py +++ b/examples/v2/test-optimization/SearchFlakyTests_209064879.py @@ -17,12 +17,12 @@ attributes=FlakyTestsSearchRequestAttributes( filter=FlakyTestsSearchFilter( query='flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"', + include_history=True, ), page=FlakyTestsSearchPageOptions( limit=10, ), sort=FlakyTestsSearchSort.FQN_ASCENDING, - include_history=True, ), type=FlakyTestsSearchRequestDataType.SEARCH_FLAKY_TESTS_REQUEST, ), diff --git a/src/datadog_api_client/v2/model/flaky_tests_search_filter.py b/src/datadog_api_client/v2/model/flaky_tests_search_filter.py index 311d2ab025..f13718f45a 100644 --- a/src/datadog_api_client/v2/model/flaky_tests_search_filter.py +++ b/src/datadog_api_client/v2/model/flaky_tests_search_filter.py @@ -17,17 +17,26 @@ class FlakyTestsSearchFilter(ModelNormal): @cached_property def openapi_types(_): return { + "include_history": (bool,), "query": (str,), } attribute_map = { + "include_history": "include_history", "query": "query", } - def __init__(self_, query: Union[str, UnsetType] = unset, **kwargs): + def __init__( + self_, include_history: Union[bool, UnsetType] = unset, query: Union[str, UnsetType] = unset, **kwargs + ): """ Search filter settings. + :param include_history: Whether to include the status change history for each flaky test in the response. + When set to true, each test will include a 'history' array with chronological status changes. + Defaults to false. + :type include_history: bool, optional + :param query: Search query following log syntax used to filter flaky tests, same as on Flaky Tests Management UI. The supported search keys are: * ``flaky_test_state`` @@ -42,6 +51,8 @@ def __init__(self_, query: Union[str, UnsetType] = unset, **kwargs): * ``env`` :type query: str, optional """ + if include_history is not unset: + kwargs["include_history"] = include_history if query is not unset: kwargs["query"] = query super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/flaky_tests_search_request_attributes.py b/src/datadog_api_client/v2/model/flaky_tests_search_request_attributes.py index 02b1cbb024..2c6cc7414a 100644 --- a/src/datadog_api_client/v2/model/flaky_tests_search_request_attributes.py +++ b/src/datadog_api_client/v2/model/flaky_tests_search_request_attributes.py @@ -28,14 +28,12 @@ def openapi_types(_): return { "filter": (FlakyTestsSearchFilter,), - "include_history": (bool,), "page": (FlakyTestsSearchPageOptions,), "sort": (FlakyTestsSearchSort,), } attribute_map = { "filter": "filter", - "include_history": "include_history", "page": "page", "sort": "sort", } @@ -43,7 +41,6 @@ def openapi_types(_): def __init__( self_, filter: Union[FlakyTestsSearchFilter, UnsetType] = unset, - include_history: Union[bool, UnsetType] = unset, page: Union[FlakyTestsSearchPageOptions, UnsetType] = unset, sort: Union[FlakyTestsSearchSort, UnsetType] = unset, **kwargs, @@ -54,11 +51,6 @@ def __init__( :param filter: Search filter settings. :type filter: FlakyTestsSearchFilter, optional - :param include_history: Whether to include the status change history for each flaky test in the response. - When set to true, each test will include a ``history`` array with chronological status changes. - Defaults to false. - :type include_history: bool, optional - :param page: Pagination attributes for listing flaky tests. :type page: FlakyTestsSearchPageOptions, optional @@ -67,8 +59,6 @@ def __init__( """ if filter is not unset: kwargs["filter"] = filter - if include_history is not unset: - kwargs["include_history"] = include_history if page is not unset: kwargs["page"] = page if sort is not unset: diff --git a/tests/v2/features/test_optimization.feature b/tests/v2/features/test_optimization.feature index bbf7d87075..1c0e758a1e 100644 --- a/tests/v2/features/test_optimization.feature +++ b/tests/v2/features/test_optimization.feature @@ -13,7 +13,7 @@ Feature: Test Optimization Scenario: Search flaky tests returns "Bad Request" response Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - 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"}} + 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"}} When the request is sent Then the response status is 400 Bad Request @@ -29,7 +29,7 @@ Feature: Test Optimization Scenario: Search flaky tests returns "OK" response Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - 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"}} + 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"}} When the request is sent Then the response status is 200 OK @@ -45,7 +45,7 @@ Feature: Test Optimization Scenario: Search flaky tests returns "OK" response with history Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - 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"}} + 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"}} When the request is sent Then the response status is 200 OK And the response "data[0].attributes" has field "history" @@ -57,7 +57,7 @@ Feature: Test Optimization Scenario: Search flaky tests returns "OK" response with pagination Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - 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"}} + 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"}} When the request with pagination is sent Then the response status is 200 OK