diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e83df8269e..8d4963e55a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -26216,9 +26216,18 @@ components: Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available. example: - commit_sha: abc123def456 + policy_id: ftm_policy.quarantine.failure_rate + policy_meta: + config: + failure_rate: 0.1 + required_runs: 100 + failure_rate: 0.25 + total_runs: 200 status: quarantined timestamp: 1704067200000 - commit_sha: "" + policy_id: unknown + policy_meta: status: new timestamp: 1703980800000 items: @@ -26288,6 +26297,11 @@ components: description: The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available. example: abc123def456 type: string + policy_id: + $ref: "#/components/schemas/FlakyTestHistoryPolicyId" + policy_meta: + $ref: "#/components/schemas/FlakyTestHistoryPolicyMeta" + nullable: true status: description: The test status at this point in history. example: quarantined @@ -26302,6 +26316,131 @@ components: - commit_sha - timestamp type: object + FlakyTestHistoryPolicyId: + description: The policy that triggered this status change. + enum: + - ftm_policy.manual + - ftm_policy.fixed + - ftm_policy.disable.failure_rate + - ftm_policy.disable.branch_flake + - ftm_policy.disable.days_active + - ftm_policy.quarantine.failure_rate + - ftm_policy.quarantine.branch_flake + - ftm_policy.quarantine.days_active + - unknown + example: ftm_policy.quarantine.failure_rate + nullable: false + type: string + x-enum-varnames: + - MANUAL + - FIXED + - DISABLE_FAILURE_RATE + - DISABLE_BRANCH_FLAKE + - DISABLE_DAYS_ACTIVE + - QUARANTINE_FAILURE_RATE + - QUARANTINE_BRANCH_FLAKE + - QUARANTINE_DAYS_ACTIVE + - UNKNOWN + FlakyTestHistoryPolicyMeta: + description: Metadata about the policy that triggered this status change. + properties: + branches: + description: Branches where the test was flaky at the time of the status change. + example: ["main", "develop"] + items: + type: string + nullable: true + type: array + config: + $ref: "#/components/schemas/FlakyTestHistoryPolicyMetaConfig" + nullable: true + days_active: + description: The number of days the test has been active at the time of the status change. + example: 15 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + days_without_flake: + description: The number of days since the test last exhibited flakiness. + example: 30 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + failure_rate: + description: The failure rate of the test at the time of the status change. + example: 0.25 + format: double + maximum: 1 + minimum: 0 + nullable: true + type: number + state: + description: The previous state of the test. + example: quarantined + nullable: true + type: string + total_runs: + description: The total number of test runs at the time of the status change. + example: 200 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + type: object + FlakyTestHistoryPolicyMetaConfig: + description: Configuration parameters of the policy that triggered this status change. + properties: + branches: + description: The branches considered by the policy. + example: ["main"] + items: + type: string + nullable: true + type: array + days_active: + description: The number of days a test must have been active for the policy to trigger. + example: 30 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + failure_rate: + description: The failure rate threshold for the policy to trigger. + example: 0.7 + format: double + maximum: 1 + minimum: 0 + nullable: true + type: number + forget_branches: + description: Branches excluded from the policy evaluation. + example: ["release"] + items: + type: string + nullable: true + type: array + required_runs: + description: The minimum number of test runs required for the policy to trigger. + example: 100 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + state: + description: The target state the policy transitions the test from. + example: quarantined + nullable: true + type: string + test_services: + description: Test services excluded from the policy evaluation. + example: ["my-service"] + items: + type: string + nullable: true + type: array + type: object FlakyTestPipelineStats: description: CI pipeline related statistics for the flaky test. This information is only available if test runs are associated with CI pipeline events from CI Visibility. properties: @@ -26381,6 +26520,14 @@ 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: |- @@ -26426,14 +26573,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/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index d1dc990342..14bf500f52 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -11169,6 +11169,27 @@ datadog\_api\_client.v2.model.flaky\_test\_history module :members: :show-inheritance: +datadog\_api\_client.v2.model.flaky\_test\_history\_policy\_id module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.flaky_test_history_policy_id + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.flaky\_test\_history\_policy\_meta module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.flaky_test_history_policy_meta + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.flaky\_test\_history\_policy\_meta\_config module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.flaky_test_history_policy_meta_config + :members: + :show-inheritance: + datadog\_api\_client.v2.model.flaky\_test\_pipeline\_stats module ----------------------------------------------------------------- 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_test_history.py b/src/datadog_api_client/v2/model/flaky_test_history.py index 6d8b8429d7..5fa75fe6bf 100644 --- a/src/datadog_api_client/v2/model/flaky_test_history.py +++ b/src/datadog_api_client/v2/model/flaky_test_history.py @@ -3,41 +3,74 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, + unset, + UnsetType, ) +if TYPE_CHECKING: + from datadog_api_client.v2.model.flaky_test_history_policy_id import FlakyTestHistoryPolicyId + from datadog_api_client.v2.model.flaky_test_history_policy_meta import FlakyTestHistoryPolicyMeta + + class FlakyTestHistory(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.flaky_test_history_policy_id import FlakyTestHistoryPolicyId + from datadog_api_client.v2.model.flaky_test_history_policy_meta import FlakyTestHistoryPolicyMeta + return { "commit_sha": (str,), + "policy_id": (FlakyTestHistoryPolicyId,), + "policy_meta": (FlakyTestHistoryPolicyMeta,), "status": (str,), "timestamp": (int,), } attribute_map = { "commit_sha": "commit_sha", + "policy_id": "policy_id", + "policy_meta": "policy_meta", "status": "status", "timestamp": "timestamp", } - def __init__(self_, commit_sha: str, status: str, timestamp: int, **kwargs): + def __init__( + self_, + commit_sha: str, + status: str, + timestamp: int, + policy_id: Union[FlakyTestHistoryPolicyId, UnsetType] = unset, + policy_meta: Union[FlakyTestHistoryPolicyMeta, UnsetType] = unset, + **kwargs, + ): """ A single history entry representing a status change for a flaky test. :param commit_sha: The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available. :type commit_sha: str + :param policy_id: The policy that triggered this status change. + :type policy_id: FlakyTestHistoryPolicyId, optional + + :param policy_meta: Metadata about the policy that triggered this status change. + :type policy_meta: FlakyTestHistoryPolicyMeta, optional + :param status: The test status at this point in history. :type status: str :param timestamp: Unix timestamp in milliseconds when this status change occurred. :type timestamp: int """ + if policy_id is not unset: + kwargs["policy_id"] = policy_id + if policy_meta is not unset: + kwargs["policy_meta"] = policy_meta super().__init__(kwargs) self_.commit_sha = commit_sha diff --git a/src/datadog_api_client/v2/model/flaky_test_history_policy_id.py b/src/datadog_api_client/v2/model/flaky_test_history_policy_id.py new file mode 100644 index 0000000000..f9f74c1aab --- /dev/null +++ b/src/datadog_api_client/v2/model/flaky_test_history_policy_id.py @@ -0,0 +1,59 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class FlakyTestHistoryPolicyId(ModelSimple): + """ + The policy that triggered this status change. + + :param value: Must be one of ["ftm_policy.manual", "ftm_policy.fixed", "ftm_policy.disable.failure_rate", "ftm_policy.disable.branch_flake", "ftm_policy.disable.days_active", "ftm_policy.quarantine.failure_rate", "ftm_policy.quarantine.branch_flake", "ftm_policy.quarantine.days_active", "unknown"]. + :type value: str + """ + + allowed_values = { + "ftm_policy.manual", + "ftm_policy.fixed", + "ftm_policy.disable.failure_rate", + "ftm_policy.disable.branch_flake", + "ftm_policy.disable.days_active", + "ftm_policy.quarantine.failure_rate", + "ftm_policy.quarantine.branch_flake", + "ftm_policy.quarantine.days_active", + "unknown", + } + MANUAL: ClassVar["FlakyTestHistoryPolicyId"] + FIXED: ClassVar["FlakyTestHistoryPolicyId"] + DISABLE_FAILURE_RATE: ClassVar["FlakyTestHistoryPolicyId"] + DISABLE_BRANCH_FLAKE: ClassVar["FlakyTestHistoryPolicyId"] + DISABLE_DAYS_ACTIVE: ClassVar["FlakyTestHistoryPolicyId"] + QUARANTINE_FAILURE_RATE: ClassVar["FlakyTestHistoryPolicyId"] + QUARANTINE_BRANCH_FLAKE: ClassVar["FlakyTestHistoryPolicyId"] + QUARANTINE_DAYS_ACTIVE: ClassVar["FlakyTestHistoryPolicyId"] + UNKNOWN: ClassVar["FlakyTestHistoryPolicyId"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FlakyTestHistoryPolicyId.MANUAL = FlakyTestHistoryPolicyId("ftm_policy.manual") +FlakyTestHistoryPolicyId.FIXED = FlakyTestHistoryPolicyId("ftm_policy.fixed") +FlakyTestHistoryPolicyId.DISABLE_FAILURE_RATE = FlakyTestHistoryPolicyId("ftm_policy.disable.failure_rate") +FlakyTestHistoryPolicyId.DISABLE_BRANCH_FLAKE = FlakyTestHistoryPolicyId("ftm_policy.disable.branch_flake") +FlakyTestHistoryPolicyId.DISABLE_DAYS_ACTIVE = FlakyTestHistoryPolicyId("ftm_policy.disable.days_active") +FlakyTestHistoryPolicyId.QUARANTINE_FAILURE_RATE = FlakyTestHistoryPolicyId("ftm_policy.quarantine.failure_rate") +FlakyTestHistoryPolicyId.QUARANTINE_BRANCH_FLAKE = FlakyTestHistoryPolicyId("ftm_policy.quarantine.branch_flake") +FlakyTestHistoryPolicyId.QUARANTINE_DAYS_ACTIVE = FlakyTestHistoryPolicyId("ftm_policy.quarantine.days_active") +FlakyTestHistoryPolicyId.UNKNOWN = FlakyTestHistoryPolicyId("unknown") diff --git a/src/datadog_api_client/v2/model/flaky_test_history_policy_meta.py b/src/datadog_api_client/v2/model/flaky_test_history_policy_meta.py new file mode 100644 index 0000000000..3cf085eecd --- /dev/null +++ b/src/datadog_api_client/v2/model/flaky_test_history_policy_meta.py @@ -0,0 +1,111 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.flaky_test_history_policy_meta_config import FlakyTestHistoryPolicyMetaConfig + + +class FlakyTestHistoryPolicyMeta(ModelNormal): + validations = { + "days_active": { + "inclusive_maximum": 2147483647, + }, + "days_without_flake": { + "inclusive_maximum": 2147483647, + }, + "failure_rate": { + "inclusive_maximum": 1, + "inclusive_minimum": 0, + }, + "total_runs": { + "inclusive_maximum": 2147483647, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.flaky_test_history_policy_meta_config import FlakyTestHistoryPolicyMetaConfig + + return { + "branches": ([str], none_type), + "config": (FlakyTestHistoryPolicyMetaConfig,), + "days_active": (int, none_type), + "days_without_flake": (int, none_type), + "failure_rate": (float, none_type), + "state": (str, none_type), + "total_runs": (int, none_type), + } + + attribute_map = { + "branches": "branches", + "config": "config", + "days_active": "days_active", + "days_without_flake": "days_without_flake", + "failure_rate": "failure_rate", + "state": "state", + "total_runs": "total_runs", + } + + def __init__( + self_, + branches: Union[List[str], none_type, UnsetType] = unset, + config: Union[FlakyTestHistoryPolicyMetaConfig, UnsetType] = unset, + days_active: Union[int, none_type, UnsetType] = unset, + days_without_flake: Union[int, none_type, UnsetType] = unset, + failure_rate: Union[float, none_type, UnsetType] = unset, + state: Union[str, none_type, UnsetType] = unset, + total_runs: Union[int, none_type, UnsetType] = unset, + **kwargs, + ): + """ + Metadata about the policy that triggered this status change. + + :param branches: Branches where the test was flaky at the time of the status change. + :type branches: [str], none_type, optional + + :param config: Configuration parameters of the policy that triggered this status change. + :type config: FlakyTestHistoryPolicyMetaConfig, optional + + :param days_active: The number of days the test has been active at the time of the status change. + :type days_active: int, none_type, optional + + :param days_without_flake: The number of days since the test last exhibited flakiness. + :type days_without_flake: int, none_type, optional + + :param failure_rate: The failure rate of the test at the time of the status change. + :type failure_rate: float, none_type, optional + + :param state: The previous state of the test. + :type state: str, none_type, optional + + :param total_runs: The total number of test runs at the time of the status change. + :type total_runs: int, none_type, optional + """ + if branches is not unset: + kwargs["branches"] = branches + if config is not unset: + kwargs["config"] = config + if days_active is not unset: + kwargs["days_active"] = days_active + if days_without_flake is not unset: + kwargs["days_without_flake"] = days_without_flake + if failure_rate is not unset: + kwargs["failure_rate"] = failure_rate + if state is not unset: + kwargs["state"] = state + if total_runs is not unset: + kwargs["total_runs"] = total_runs + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/flaky_test_history_policy_meta_config.py b/src/datadog_api_client/v2/model/flaky_test_history_policy_meta_config.py new file mode 100644 index 0000000000..04ac06006a --- /dev/null +++ b/src/datadog_api_client/v2/model/flaky_test_history_policy_meta_config.py @@ -0,0 +1,102 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +class FlakyTestHistoryPolicyMetaConfig(ModelNormal): + validations = { + "days_active": { + "inclusive_maximum": 2147483647, + }, + "failure_rate": { + "inclusive_maximum": 1, + "inclusive_minimum": 0, + }, + "required_runs": { + "inclusive_maximum": 2147483647, + }, + } + + @cached_property + def openapi_types(_): + return { + "branches": ([str], none_type), + "days_active": (int, none_type), + "failure_rate": (float, none_type), + "forget_branches": ([str], none_type), + "required_runs": (int, none_type), + "state": (str, none_type), + "test_services": ([str], none_type), + } + + attribute_map = { + "branches": "branches", + "days_active": "days_active", + "failure_rate": "failure_rate", + "forget_branches": "forget_branches", + "required_runs": "required_runs", + "state": "state", + "test_services": "test_services", + } + + def __init__( + self_, + branches: Union[List[str], none_type, UnsetType] = unset, + days_active: Union[int, none_type, UnsetType] = unset, + failure_rate: Union[float, none_type, UnsetType] = unset, + forget_branches: Union[List[str], none_type, UnsetType] = unset, + required_runs: Union[int, none_type, UnsetType] = unset, + state: Union[str, none_type, UnsetType] = unset, + test_services: Union[List[str], none_type, UnsetType] = unset, + **kwargs, + ): + """ + Configuration parameters of the policy that triggered this status change. + + :param branches: The branches considered by the policy. + :type branches: [str], none_type, optional + + :param days_active: The number of days a test must have been active for the policy to trigger. + :type days_active: int, none_type, optional + + :param failure_rate: The failure rate threshold for the policy to trigger. + :type failure_rate: float, none_type, optional + + :param forget_branches: Branches excluded from the policy evaluation. + :type forget_branches: [str], none_type, optional + + :param required_runs: The minimum number of test runs required for the policy to trigger. + :type required_runs: int, none_type, optional + + :param state: The target state the policy transitions the test from. + :type state: str, none_type, optional + + :param test_services: Test services excluded from the policy evaluation. + :type test_services: [str], none_type, optional + """ + if branches is not unset: + kwargs["branches"] = branches + if days_active is not unset: + kwargs["days_active"] = days_active + if failure_rate is not unset: + kwargs["failure_rate"] = failure_rate + if forget_branches is not unset: + kwargs["forget_branches"] = forget_branches + if required_runs is not unset: + kwargs["required_runs"] = required_runs + if state is not unset: + kwargs["state"] = state + if test_services is not unset: + kwargs["test_services"] = test_services + super().__init__(kwargs) 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..0c1c64b516 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/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 22f4a4d800..fdaa713d68 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2175,6 +2175,9 @@ from datadog_api_client.v2.model.flaky_test_attributes import FlakyTestAttributes from datadog_api_client.v2.model.flaky_test_attributes_flaky_state import FlakyTestAttributesFlakyState from datadog_api_client.v2.model.flaky_test_history import FlakyTestHistory +from datadog_api_client.v2.model.flaky_test_history_policy_id import FlakyTestHistoryPolicyId +from datadog_api_client.v2.model.flaky_test_history_policy_meta import FlakyTestHistoryPolicyMeta +from datadog_api_client.v2.model.flaky_test_history_policy_meta_config import FlakyTestHistoryPolicyMetaConfig from datadog_api_client.v2.model.flaky_test_pipeline_stats import FlakyTestPipelineStats from datadog_api_client.v2.model.flaky_test_run_metadata import FlakyTestRunMetadata from datadog_api_client.v2.model.flaky_test_stats import FlakyTestStats @@ -8402,6 +8405,9 @@ "FlakyTestAttributes", "FlakyTestAttributesFlakyState", "FlakyTestHistory", + "FlakyTestHistoryPolicyId", + "FlakyTestHistoryPolicyMeta", + "FlakyTestHistoryPolicyMetaConfig", "FlakyTestPipelineStats", "FlakyTestRunMetadata", "FlakyTestStats", diff --git a/tests/v2/features/test_optimization.feature b/tests/v2/features/test_optimization.feature index 427db05baf..27f337f929 100644 --- a/tests/v2/features/test_optimization.feature +++ b/tests/v2/features/test_optimization.feature @@ -85,7 +85,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 @@ -101,7 +101,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 @@ -117,19 +117,21 @@ 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" And the response "data[0].attributes.history[0]" has field "status" And the response "data[0].attributes.history[0]" has field "commit_sha" And the response "data[0].attributes.history[0]" has field "timestamp" + And the response "data[0].attributes.history[0]" has field "policy_id" + And the response "data[0].attributes.history[0]" has field "policy_meta" @generated @skip @team:DataDog/ci-app-backend @with-pagination 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