diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 838f5745fd..ad11665c83 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -14597,6 +14597,61 @@ components: oneOf: - $ref: '#/components/schemas/SyntheticsAPITestStep' - $ref: '#/components/schemas/SyntheticsAPIWaitStep' + - $ref: '#/components/schemas/SyntheticsAPISubtestStep' + SyntheticsAPISubtestStep: + description: The subtest step used in a Synthetics multi-step API test. + properties: + allowFailure: + description: Determines whether or not to continue with test if this step + fails. + type: boolean + alwaysExecute: + description: A boolean set to always execute this step even if the previous + step failed or was skipped. + type: boolean + exitIfSucceed: + description: Determines whether or not to exit the test if the step succeeds. + type: boolean + extractedValuesFromScript: + description: Generate variables using JavaScript. + type: string + id: + description: ID of the step. + example: abc-def-123 + readOnly: true + type: string + isCritical: + description: 'Determines whether or not to consider the entire test as failed + if this step fails. + + Can be used only if `allowFailure` is `true`.' + type: boolean + name: + description: The name of the step. + example: Example step name + type: string + retry: + $ref: '#/components/schemas/SyntheticsTestOptionsRetry' + subtestPublicId: + description: Public ID of the test to be played as part of a `playSubTest` + step type. + example: '' + type: string + subtype: + $ref: '#/components/schemas/SyntheticsAPISubtestStepSubtype' + required: + - name + - subtype + - subtestPublicId + type: object + SyntheticsAPISubtestStepSubtype: + description: The subtype of the Synthetic multi-step API subtest step. + enum: + - playSubTest + example: playSubTest + type: string + x-enum-varnames: + - PLAY_SUB_TEST SyntheticsAPITest: description: Object containing details about a Synthetic API test. properties: diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index 60a000a874..6f9bf1e3f7 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -4106,6 +4106,20 @@ datadog\_api\_client.v1.model.synthetics\_api\_step module :members: :show-inheritance: +datadog\_api\_client.v1.model.synthetics\_api\_subtest\_step module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.synthetics_api_subtest_step + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.synthetics\_api\_subtest\_step\_subtype module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.synthetics_api_subtest_step_subtype + :members: + :show-inheritance: + datadog\_api\_client.v1.model.synthetics\_api\_test module ---------------------------------------------------------- diff --git a/examples/v1/synthetics/CreateSyntheticsAPITest_2106135939.py b/examples/v1/synthetics/CreateSyntheticsAPITest_2106135939.py new file mode 100644 index 0000000000..29c344234f --- /dev/null +++ b/examples/v1/synthetics/CreateSyntheticsAPITest_2106135939.py @@ -0,0 +1,72 @@ +""" +Create a multistep test with subtest returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.synthetics_api import SyntheticsApi +from datadog_api_client.v1.model.synthetics_api_subtest_step import SyntheticsAPISubtestStep +from datadog_api_client.v1.model.synthetics_api_subtest_step_subtype import SyntheticsAPISubtestStepSubtype +from datadog_api_client.v1.model.synthetics_api_test import SyntheticsAPITest +from datadog_api_client.v1.model.synthetics_api_test_config import SyntheticsAPITestConfig +from datadog_api_client.v1.model.synthetics_api_test_step import SyntheticsAPITestStep +from datadog_api_client.v1.model.synthetics_api_test_step_subtype import SyntheticsAPITestStepSubtype +from datadog_api_client.v1.model.synthetics_api_test_type import SyntheticsAPITestType +from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator +from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget +from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType +from datadog_api_client.v1.model.synthetics_basic_auth_web import SyntheticsBasicAuthWeb +from datadog_api_client.v1.model.synthetics_test_details_sub_type import SyntheticsTestDetailsSubType +from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions +from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest + +# there is a valid "synthetics_api_test" in the system +SYNTHETICS_API_TEST_PUBLIC_ID = environ["SYNTHETICS_API_TEST_PUBLIC_ID"] + +body = SyntheticsAPITest( + config=SyntheticsAPITestConfig( + steps=[ + SyntheticsAPITestStep( + assertions=[ + SyntheticsAssertionTarget( + operator=SyntheticsAssertionOperator.IS, + type=SyntheticsAssertionType.STATUS_CODE, + target=200, + ), + ], + name="request is sent", + request=SyntheticsTestRequest( + url="https://httpbin.org/status/200", + method="GET", + basic_auth=SyntheticsBasicAuthWeb( + password="password", + username="username", + ), + ), + subtype=SyntheticsAPITestStepSubtype.HTTP, + ), + SyntheticsAPISubtestStep( + subtype=SyntheticsAPISubtestStepSubtype.PLAY_SUB_TEST, + subtest_public_id=SYNTHETICS_API_TEST_PUBLIC_ID, + name="subtest step", + ), + ], + ), + locations=[ + "aws:us-east-2", + ], + message="BDD test payload: synthetics_api_test_multi_step_with_subtest.json", + name="Example-Synthetic", + options=SyntheticsTestOptions( + tick_every=60, + ), + subtype=SyntheticsTestDetailsSubType.MULTI, + type=SyntheticsAPITestType.API, +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = SyntheticsApi(api_client) + response = api_instance.create_synthetics_api_test(body=body) + + print(response) diff --git a/src/datadog_api_client/v1/model/synthetics_api_step.py b/src/datadog_api_client/v1/model/synthetics_api_step.py index 03d5315d41..b9047f9e13 100644 --- a/src/datadog_api_client/v1/model/synthetics_api_step.py +++ b/src/datadog_api_client/v1/model/synthetics_api_step.py @@ -51,6 +51,12 @@ def __init__(self, **kwargs): :param value: The time to wait in seconds. Minimum value: 0. Maximum value: 180. :type value: int + + :param always_execute: A boolean set to always execute this step even if the previous step failed or was skipped. + :type always_execute: bool, optional + + :param subtest_public_id: Public ID of the test to be played as part of a `playSubTest` step type. + :type subtest_public_id: str """ super().__init__(kwargs) @@ -65,10 +71,12 @@ def _composed_schemas(_): # loading from datadog_api_client.v1.model.synthetics_api_test_step import SyntheticsAPITestStep from datadog_api_client.v1.model.synthetics_api_wait_step import SyntheticsAPIWaitStep + from datadog_api_client.v1.model.synthetics_api_subtest_step import SyntheticsAPISubtestStep return { "oneOf": [ SyntheticsAPITestStep, SyntheticsAPIWaitStep, + SyntheticsAPISubtestStep, ], } diff --git a/src/datadog_api_client/v1/model/synthetics_api_subtest_step.py b/src/datadog_api_client/v1/model/synthetics_api_subtest_step.py new file mode 100644 index 0000000000..82fc7fb4ac --- /dev/null +++ b/src/datadog_api_client/v1/model/synthetics_api_subtest_step.py @@ -0,0 +1,122 @@ +# 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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry + from datadog_api_client.v1.model.synthetics_api_subtest_step_subtype import SyntheticsAPISubtestStepSubtype + + +class SyntheticsAPISubtestStep(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry + from datadog_api_client.v1.model.synthetics_api_subtest_step_subtype import SyntheticsAPISubtestStepSubtype + + return { + "allow_failure": (bool,), + "always_execute": (bool,), + "exit_if_succeed": (bool,), + "extracted_values_from_script": (str,), + "id": (str,), + "is_critical": (bool,), + "name": (str,), + "retry": (SyntheticsTestOptionsRetry,), + "subtest_public_id": (str,), + "subtype": (SyntheticsAPISubtestStepSubtype,), + } + + attribute_map = { + "allow_failure": "allowFailure", + "always_execute": "alwaysExecute", + "exit_if_succeed": "exitIfSucceed", + "extracted_values_from_script": "extractedValuesFromScript", + "id": "id", + "is_critical": "isCritical", + "name": "name", + "retry": "retry", + "subtest_public_id": "subtestPublicId", + "subtype": "subtype", + } + read_only_vars = { + "id", + } + + def __init__( + self_, + name: str, + subtest_public_id: str, + subtype: SyntheticsAPISubtestStepSubtype, + allow_failure: Union[bool, UnsetType] = unset, + always_execute: Union[bool, UnsetType] = unset, + exit_if_succeed: Union[bool, UnsetType] = unset, + extracted_values_from_script: Union[str, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + is_critical: Union[bool, UnsetType] = unset, + retry: Union[SyntheticsTestOptionsRetry, UnsetType] = unset, + **kwargs, + ): + """ + The subtest step used in a Synthetics multi-step API test. + + :param allow_failure: Determines whether or not to continue with test if this step fails. + :type allow_failure: bool, optional + + :param always_execute: A boolean set to always execute this step even if the previous step failed or was skipped. + :type always_execute: bool, optional + + :param exit_if_succeed: Determines whether or not to exit the test if the step succeeds. + :type exit_if_succeed: bool, optional + + :param extracted_values_from_script: Generate variables using JavaScript. + :type extracted_values_from_script: str, optional + + :param id: ID of the step. + :type id: str, optional + + :param is_critical: Determines whether or not to consider the entire test as failed if this step fails. + Can be used only if ``allowFailure`` is ``true``. + :type is_critical: bool, optional + + :param name: The name of the step. + :type name: str + + :param retry: Object describing the retry strategy to apply to a Synthetic test. + :type retry: SyntheticsTestOptionsRetry, optional + + :param subtest_public_id: Public ID of the test to be played as part of a ``playSubTest`` step type. + :type subtest_public_id: str + + :param subtype: The subtype of the Synthetic multi-step API subtest step. + :type subtype: SyntheticsAPISubtestStepSubtype + """ + if allow_failure is not unset: + kwargs["allow_failure"] = allow_failure + if always_execute is not unset: + kwargs["always_execute"] = always_execute + if exit_if_succeed is not unset: + kwargs["exit_if_succeed"] = exit_if_succeed + if extracted_values_from_script is not unset: + kwargs["extracted_values_from_script"] = extracted_values_from_script + if id is not unset: + kwargs["id"] = id + if is_critical is not unset: + kwargs["is_critical"] = is_critical + if retry is not unset: + kwargs["retry"] = retry + super().__init__(kwargs) + + self_.name = name + self_.subtest_public_id = subtest_public_id + self_.subtype = subtype diff --git a/src/datadog_api_client/v1/model/synthetics_api_subtest_step_subtype.py b/src/datadog_api_client/v1/model/synthetics_api_subtest_step_subtype.py new file mode 100644 index 0000000000..90a8ce3a23 --- /dev/null +++ b/src/datadog_api_client/v1/model/synthetics_api_subtest_step_subtype.py @@ -0,0 +1,35 @@ +# 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 SyntheticsAPISubtestStepSubtype(ModelSimple): + """ + The subtype of the Synthetic multi-step API subtest step. + + :param value: If omitted defaults to "playSubTest". Must be one of ["playSubTest"]. + :type value: str + """ + + allowed_values = { + "playSubTest", + } + PLAY_SUB_TEST: ClassVar["SyntheticsAPISubtestStepSubtype"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +SyntheticsAPISubtestStepSubtype.PLAY_SUB_TEST = SyntheticsAPISubtestStepSubtype("playSubTest") diff --git a/src/datadog_api_client/v1/model/synthetics_api_test_config.py b/src/datadog_api_client/v1/model/synthetics_api_test_config.py index 65e74f8f21..93b1166862 100644 --- a/src/datadog_api_client/v1/model/synthetics_api_test_config.py +++ b/src/datadog_api_client/v1/model/synthetics_api_test_config.py @@ -26,6 +26,7 @@ from datadog_api_client.v1.model.synthetics_assertion_javascript import SyntheticsAssertionJavascript from datadog_api_client.v1.model.synthetics_api_test_step import SyntheticsAPITestStep from datadog_api_client.v1.model.synthetics_api_wait_step import SyntheticsAPIWaitStep + from datadog_api_client.v1.model.synthetics_api_subtest_step import SyntheticsAPISubtestStep class SyntheticsAPITestConfig(ModelNormal): @@ -70,7 +71,10 @@ def __init__( ] = unset, config_variables: Union[List[SyntheticsConfigVariable], UnsetType] = unset, request: Union[SyntheticsTestRequest, UnsetType] = unset, - steps: Union[List[Union[SyntheticsAPIStep, SyntheticsAPITestStep, SyntheticsAPIWaitStep]], UnsetType] = unset, + steps: Union[ + List[Union[SyntheticsAPIStep, SyntheticsAPITestStep, SyntheticsAPIWaitStep, SyntheticsAPISubtestStep]], + UnsetType, + ] = unset, variables_from_script: Union[str, UnsetType] = unset, **kwargs, ): diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 062b19bebe..876fddfb37 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -666,6 +666,8 @@ from datadog_api_client.v1.model.sunburst_widget_legend_table_type import SunburstWidgetLegendTableType from datadog_api_client.v1.model.sunburst_widget_request import SunburstWidgetRequest from datadog_api_client.v1.model.synthetics_api_step import SyntheticsAPIStep +from datadog_api_client.v1.model.synthetics_api_subtest_step import SyntheticsAPISubtestStep +from datadog_api_client.v1.model.synthetics_api_subtest_step_subtype import SyntheticsAPISubtestStepSubtype from datadog_api_client.v1.model.synthetics_api_test import SyntheticsAPITest from datadog_api_client.v1.model.synthetics_api_test_config import SyntheticsAPITestConfig from datadog_api_client.v1.model.synthetics_api_test_result_data import SyntheticsAPITestResultData @@ -1709,6 +1711,8 @@ "SunburstWidgetLegendTableType", "SunburstWidgetRequest", "SyntheticsAPIStep", + "SyntheticsAPISubtestStep", + "SyntheticsAPISubtestStepSubtype", "SyntheticsAPITest", "SyntheticsAPITestConfig", "SyntheticsAPITestResultData", diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_multistep_test_with_subtest_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_multistep_test_with_subtest_returns_ok_response.frozen new file mode 100644 index 0000000000..6a42079e5a --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_multistep_test_with_subtest_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-12-26T15:22:45.114Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_multistep_test_with_subtest_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_multistep_test_with_subtest_returns_ok_response.yaml new file mode 100644 index 0000000000..adaccf96e7 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_multistep_test_with_subtest_returns_ok_response.yaml @@ -0,0 +1,95 @@ +interactions: +- request: + body: '{"config":{"assertions":[{"operator":"is","property":"{{ PROPERTY }}","target":"text/html","type":"header"},{"operator":"lessThan","target":2000,"timingsScope":"withoutDNS","type":"responseTime"},{"operator":"validatesJSONPath","target":{"jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"},{"operator":"validatesJSONPath","target":{"elementsOperator":"atLeastOneElementMatches","jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"},{"operator":"validatesJSONSchema","target":{"jsonSchema":"{\"type\": + \"object\", \"properties\":{\"slideshow\":{\"type\":\"object\"}}}","metaSchema":"draft-07"},"type":"body"},{"operator":"validatesXPath","target":{"operator":"contains","targetValue":"0","xPath":"target-xpath"},"type":"body"},{"operator":"md5","target":"a","type":"bodyHash"},{"code":"const + hello = ''world'';","type":"javascript"}],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"basicAuth":{"accessTokenUrl":"https://datadog-token.com","audience":"audience","clientId":"client-id","clientSecret":"client-secret","resource":"resource","scope":"yoyo","tokenApiAuthentication":"header","type":"oauth-client"},"certificate":{"cert":{"content":"cert-content","filename":"cert-filename","updatedAt":"2020-10-16T09:23:24.857Z"},"key":{"content":"key-content","filename":"key-filename","updatedAt":"2020-10-16T09:23:24.857Z"}},"headers":{"unique":"testcreateamultisteptestwithsubtestreturnsokresponse1766762565"},"method":"GET","persistCookies":true,"proxy":{"headers":{},"url":"https://datadoghq.com"},"timeout":10,"url":"https://datadoghq.com"},"variablesFromScript":"dd.variable.set(\"FOO\", + \"foo\")"},"locations":["aws:us-east-2"],"message":"BDD test payload: synthetics_api_http_test_payload.json","name":"Test-Create_a_multistep_test_with_subtest_returns_OK_response-1766762565","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_a_multistep_test_with_subtest_returns_OK_response-1766762565","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/synthetics/tests/api + response: + body: + string: '{"public_id":"f8v-zk3-x5h","name":"Test-Create_a_multistep_test_with_subtest_returns_OK_response-1766762565","status":"live","type":"api","subtype":"http","tags":["testing:api"],"created_at":"2025-12-26T15:22:45.449340+00:00","modified_at":"2025-12-26T15:22:45.449340+00:00","config":{"assertions":[{"operator":"is","property":"{{ + PROPERTY }}","target":"text/html","type":"header"},{"operator":"lessThan","target":2000,"timingsScope":"withoutDNS","type":"responseTime"},{"operator":"validatesJSONPath","target":{"jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"},{"operator":"validatesJSONPath","target":{"elementsOperator":"atLeastOneElementMatches","jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"},{"operator":"validatesJSONSchema","target":{"jsonSchema":"{\"type\": + \"object\", \"properties\":{\"slideshow\":{\"type\":\"object\"}}}","metaSchema":"draft-07"},"type":"body"},{"operator":"validatesXPath","target":{"operator":"contains","targetValue":"0","xPath":"target-xpath"},"type":"body"},{"operator":"md5","target":"a","type":"bodyHash"},{"code":"const + hello = ''world'';","type":"javascript"}],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"basicAuth":{"accessTokenUrl":"https://datadog-token.com","audience":"audience","clientId":"client-id","clientSecret":"client-secret","resource":"resource","scope":"yoyo","tokenApiAuthentication":"header","type":"oauth-client"},"certificate":{"cert":{"filename":"cert-filename","updatedAt":"2020-10-16T09:23:24.857Z"},"key":{"filename":"key-filename","updatedAt":"2020-10-16T09:23:24.857Z"}},"headers":{"unique":"testcreateamultisteptestwithsubtestreturnsokresponse1766762565"},"method":"GET","persistCookies":true,"proxy":{"headers":{},"url":"https://datadoghq.com"},"timeout":10,"url":"https://datadoghq.com"},"variablesFromScript":"dd.variable.set(\"FOO\", + \"foo\")"},"message":"BDD test payload: synthetics_api_http_test_payload.json","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_a_multistep_test_with_subtest_returns_OK_response-1766762565","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"created_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"},"deleted_at":null,"monitor_id":246774114,"org_id":321813,"modified_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"}}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"config":{"steps":[{"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"name":"request + is sent","request":{"basicAuth":{"password":"password","username":"username"},"method":"GET","url":"https://httpbin.org/status/200"},"subtype":"http"},{"name":"subtest + step","subtestPublicId":"f8v-zk3-x5h","subtype":"playSubTest"}]},"locations":["aws:us-east-2"],"message":"BDD + test payload: synthetics_api_test_multi_step_with_subtest.json","name":"Test-Create_a_multistep_test_with_subtest_returns_OK_response-1766762565","options":{"tick_every":60},"subtype":"multi","type":"api"}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/synthetics/tests/api + response: + body: + string: '{"public_id":"5kg-4fz-eh9","name":"Test-Create_a_multistep_test_with_subtest_returns_OK_response-1766762565","status":"live","type":"api","subtype":"multi","tags":[],"created_at":"2025-12-26T15:22:45.980687+00:00","modified_at":"2025-12-26T15:22:45.980687+00:00","config":{"steps":[{"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"name":"request + is sent","request":{"basicAuth":{"password":"password","username":"username"},"method":"GET","url":"https://httpbin.org/status/200"},"subtype":"http","id":"cyy-kz8-9b6"},{"name":"subtest + step","subtestPublicId":"f8v-zk3-x5h","subtype":"playSubTest","id":"se7-rsj-k3p"}]},"message":"BDD + test payload: synthetics_api_test_multi_step_with_subtest.json","options":{"tick_every":60},"locations":["aws:us-east-2"],"created_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"},"deleted_at":null,"monitor_id":246774122,"org_id":321813,"modified_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"}}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"public_ids":["5kg-4fz-eh9"]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/synthetics/tests/delete + response: + body: + string: '{"deleted_tests":[{"public_id":"5kg-4fz-eh9","deleted_at":"2025-12-26T15:22:46.386306+00:00"}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"public_ids":["f8v-zk3-x5h"]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/synthetics/tests/delete + response: + body: + string: '{"deleted_tests":[{"public_id":"f8v-zk3-x5h","deleted_at":"2025-12-26T15:22:46.982158+00:00"}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v1/features/synthetics.feature b/tests/v1/features/synthetics.feature index 4d3e23061a..25b209f05a 100644 --- a/tests/v1/features/synthetics.feature +++ b/tests/v1/features/synthetics.feature @@ -169,6 +169,14 @@ Feature: Synthetics And the response "config.steps[5].request.basicAuth.type" is equal to "oauth-client" And the response "config.steps[6].request.basicAuth.type" is equal to "oauth-rop" + @team:DataDog/synthetics-managing + Scenario: Create a multistep test with subtest returns "OK" response + Given there is a valid "synthetics_api_test" in the system + And new "CreateSyntheticsAPITest" request + And body from file "synthetics_api_test_multi_step_with_subtest.json" + When the request is sent + Then the response status is 200 OK + @replay-only @team:DataDog/synthetics-managing Scenario: Create a private location returns "OK" response Given there is a valid "role" in the system diff --git a/tests/v1/features/synthetics_api_test_multi_step_with_subtest.json b/tests/v1/features/synthetics_api_test_multi_step_with_subtest.json new file mode 100644 index 0000000000..5d7375c18a --- /dev/null +++ b/tests/v1/features/synthetics_api_test_multi_step_with_subtest.json @@ -0,0 +1,38 @@ +{ + "config": { + "steps": [ + { + "assertions": [ + { + "operator": "is", + "type": "statusCode", + "target": 200 + } + ], + "name": "request is sent", + "request": { + "url": "https://httpbin.org/status/200", + "method": "GET", + "basicAuth": { + "password": "password", + "username": "username" + } + }, + "subtype": "http" + }, + { + "subtype": "playSubTest", + "subtestPublicId": "{{ synthetics_api_test.public_id }}", + "name": "subtest step" + } + ] + }, + "locations": ["aws:us-east-2"], + "message": "BDD test payload: synthetics_api_test_multi_step_with_subtest.json", + "name": "{{ unique }}", + "options": { + "tick_every": 60 + }, + "subtype": "multi", + "type": "api" +}