Skip to content

Commit 08d831a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Add extractedValuesFromScript to multistep API tests (#2426)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 7b2f392 commit 08d831a

16 files changed

+80
-55
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-02-27 13:36:38.796211",
8-
"spec_repo_commit": "91ac2533"
7+
"regenerated": "2025-02-27 14:00:43.001632",
8+
"spec_repo_commit": "240ec82d"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-02-27 13:36:38.811846",
13-
"spec_repo_commit": "91ac2533"
12+
"regenerated": "2025-02-27 14:00:43.016339",
13+
"spec_repo_commit": "240ec82d"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14028,6 +14028,9 @@ components:
1402814028
items:
1402914029
$ref: '#/components/schemas/SyntheticsParsingOptions'
1403014030
type: array
14031+
extractedValuesFromScript:
14032+
description: Generate variables using JavaScript.
14033+
type: string
1403114034
isCritical:
1403214035
description: 'Determines whether or not to consider the entire test as failed
1403314036
if this step fails.

examples/v1/synthetics/CreateSyntheticsAPITest_1279271422.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
interval=1000.0,
7676
),
7777
subtype=SyntheticsAPITestStepSubtype.HTTP,
78+
extracted_values_from_script="dd.variable.set('STATUS_CODE', dd.response.statusCode);",
7879
),
7980
SyntheticsAPIWaitStep(
8081
name="Wait",

src/datadog_api_client/v1/model/synthetics_api_step.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ def __init__(self, **kwargs):
2727
:param extracted_values: Array of values to parse and save as variables from the response.
2828
:type extracted_values: [SyntheticsParsingOptions], optional
2929
30+
:param extracted_values_from_script: Generate variables using JavaScript.
31+
:type extracted_values_from_script: str, optional
32+
3033
:param is_critical: Determines whether or not to consider the entire test as failed if this step fails.
3134
Can be used only if `allowFailure` is `true`.
3235
:type is_critical: bool, optional

src/datadog_api_client/v1/model/synthetics_api_test_step.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def openapi_types(_):
3434
"assertions": ([SyntheticsAssertion],),
3535
"exit_if_succeed": (bool,),
3636
"extracted_values": ([SyntheticsParsingOptions],),
37+
"extracted_values_from_script": (str,),
3738
"is_critical": (bool,),
3839
"name": (str,),
3940
"request": (SyntheticsTestRequest,),
@@ -46,6 +47,7 @@ def openapi_types(_):
4647
"assertions": "assertions",
4748
"exit_if_succeed": "exitIfSucceed",
4849
"extracted_values": "extractedValues",
50+
"extracted_values_from_script": "extractedValuesFromScript",
4951
"is_critical": "isCritical",
5052
"name": "name",
5153
"request": "request",
@@ -61,6 +63,7 @@ def __init__(
6163
allow_failure: Union[bool, UnsetType] = unset,
6264
exit_if_succeed: Union[bool, UnsetType] = unset,
6365
extracted_values: Union[List[SyntheticsParsingOptions], UnsetType] = unset,
66+
extracted_values_from_script: Union[str, UnsetType] = unset,
6467
is_critical: Union[bool, UnsetType] = unset,
6568
retry: Union[SyntheticsTestOptionsRetry, UnsetType] = unset,
6669
**kwargs,
@@ -80,6 +83,9 @@ def __init__(
8083
:param extracted_values: Array of values to parse and save as variables from the response.
8184
:type extracted_values: [SyntheticsParsingOptions], optional
8285
86+
:param extracted_values_from_script: Generate variables using JavaScript.
87+
:type extracted_values_from_script: str, optional
88+
8389
:param is_critical: Determines whether or not to consider the entire test as failed if this step fails.
8490
Can be used only if ``allowFailure`` is ``true``.
8591
:type is_critical: bool, optional
@@ -102,6 +108,8 @@ def __init__(
102108
kwargs["exit_if_succeed"] = exit_if_succeed
103109
if extracted_values is not unset:
104110
kwargs["extracted_values"] = extracted_values
111+
if extracted_values_from_script is not unset:
112+
kwargs["extracted_values_from_script"] = extracted_values_from_script
105113
if is_critical is not unset:
106114
kwargs["is_critical"] = is_critical
107115
if retry is not unset:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-12-09T11:17:37.828Z
1+
2025-02-25T16:34:23.928Z

tests/v1/cassettes/test_scenarios/test_create_a_fido_global_variable_returns_ok_response.yaml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
interactions:
22
- request:
3-
body: '{"config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"exitIfSucceed":true,"extractedValues":[{"field":"server","name":"EXTRACTED_VALUE","parser":{"type":"raw"},"secure":true,"type":"http_header"}],"isCritical":true,"name":"request
4-
is sent","request":{"httpVersion":"http2","method":"GET","timeout":10,"url":"https://datadoghq.com"},"retry":{"count":5,"interval":1000},"subtype":"http"},{"name":"Wait","subtype":"wait","value":1},{"allowFailure":false,"assertions":[{"operator":"lessThan","target":1000,"type":"responseTime"}],"extractedValues":[],"isCritical":true,"name":"GRPC
3+
body: '{"config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"exitIfSucceed":true,"extractedValues":[{"field":"server","name":"EXTRACTED_VALUE","parser":{"type":"raw"},"secure":true,"type":"http_header"}],"extractedValuesFromScript":"dd.variable.set(''STATUS_CODE'',
4+
dd.response.statusCode);","isCritical":true,"name":"request is sent","request":{"httpVersion":"http2","method":"GET","timeout":10,"url":"https://datadoghq.com"},"retry":{"count":5,"interval":1000},"subtype":"http"},{"name":"Wait","subtype":"wait","value":1},{"allowFailure":false,"assertions":[{"operator":"lessThan","target":1000,"type":"responseTime"}],"extractedValues":[],"isCritical":true,"name":"GRPC
55
CALL","request":{"callType":"unary","compressedJsonDescriptor":"eJy1lU1z2yAQhv+Lzj74I3ETH506bQ7OZOSm1w4Wa4epBARQppqM/3v5koCJJdvtxCdW77vPssCO3zMKUgHOFu/ZXvBiS6hZho/f8qe7pftYgXphWJrlA8XwxywEvNba+6PhkC2yVcVVswYp0R6ykRYlZ1SCV21SDrxsssPIeS9FJKqGfK2rqnmmSBwhWa2XlKgtaQPiDcRGCUDVfwGD2sKUqKEtc1cSoOrsMlaMOec1sySYCCgUYRSVLv2zSva2u+FQkB0pVkIw8bFuIudOOn3pOaKYVT3Iy97Pd0AYhOx5QcMsnxvRHlnuLf8ETDd3CNtrv2nejkDpRnANCmGkkFn/hsYzpBKE7jVbufgnKnV9HRM9zRPDDKPttYT61n0TdWkAAjggk9AhuxIeaXd69CYTcsGw7cBTakLVbNpRzGEgyWjkSOpMbZXkhGL6oX30R49qt3GoHrap7i0XdD41WQ+2icCNm5p1hmFqnHNlcla0riKmDZ183crDxChjbnurtxHPRE784sVhWvDfGP+SsTKibU3o5NtWHuZFGZOxP6P5VXqIOvaOSec4eYohyd7NslHuJbd1bewds85xYrNxkr2d+5IhFWF3NvaO684xjE2S5ulY+tu64Pna0fCPJgzw6vF5/WucLcYjt5xoq19O3UDptOg/OamJQRaCcPPnMTQ2QDFn+uhPvUfnCrMc99upyQY4Ui9Dlc/YoG3R/v4Cs9YE+g==","host":"grpcbin.test.k6.io","message":"{}","metadata":{},"method":"Index","port":9000,"service":"grpcbin.GRPCBin"},"retry":{"count":0,"interval":300},"subtype":"grpc"}]},"locations":["aws:us-east-2"],"message":"BDD
6-
test payload: synthetics_api_test_multi_step_payload.json","name":"Test-Create_a_FIDO_global_variable_returns_OK_response-1733743057","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_a_FIDO_global_variable_returns_OK_response-1733743057","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"subtype":"multi","tags":["testing:api"],"type":"api"}'
6+
test payload: synthetics_api_test_multi_step_payload.json","name":"Test-Create_a_FIDO_global_variable_returns_OK_response-1740501263","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_a_FIDO_global_variable_returns_OK_response-1740501263","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"subtype":"multi","tags":["testing:api"],"type":"api"}'
77
headers:
88
accept:
99
- application/json
@@ -13,18 +13,20 @@ interactions:
1313
uri: https://api.datadoghq.com/api/v1/synthetics/tests/api
1414
response:
1515
body:
16-
string: '{"public_id":"2ym-xig-di5","name":"Test-Create_a_FIDO_global_variable_returns_OK_response-1733743057","status":"live","type":"api","subtype":"multi","tags":["testing:api"],"created_at":"2024-12-09T11:17:38.620924+00:00","modified_at":"2024-12-09T11:17:38.620924+00:00","config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"exitIfSucceed":true,"extractedValues":[{"field":"server","name":"EXTRACTED_VALUE","parser":{"type":"raw"},"secure":true,"type":"http_header"}],"isCritical":true,"name":"request
17-
is sent","request":{"httpVersion":"http2","method":"GET","timeout":10,"url":"https://datadoghq.com"},"retry":{"count":5,"interval":1000},"subtype":"http","id":"669-hdh-vh3"},{"name":"Wait","subtype":"wait","value":1,"id":"hkh-v6r-ddp"},{"allowFailure":false,"assertions":[{"operator":"lessThan","target":1000,"type":"responseTime"}],"extractedValues":[],"isCritical":true,"name":"GRPC
18-
CALL","request":{"callType":"unary","compressedJsonDescriptor":"eJy1lU1z2yAQhv+Lzj74I3ETH506bQ7OZOSm1w4Wa4epBARQppqM/3v5koCJJdvtxCdW77vPssCO3zMKUgHOFu/ZXvBiS6hZho/f8qe7pftYgXphWJrlA8XwxywEvNba+6PhkC2yVcVVswYp0R6ykRYlZ1SCV21SDrxsssPIeS9FJKqGfK2rqnmmSBwhWa2XlKgtaQPiDcRGCUDVfwGD2sKUqKEtc1cSoOrsMlaMOec1sySYCCgUYRSVLv2zSva2u+FQkB0pVkIw8bFuIudOOn3pOaKYVT3Iy97Pd0AYhOx5QcMsnxvRHlnuLf8ETDd3CNtrv2nejkDpRnANCmGkkFn/hsYzpBKE7jVbufgnKnV9HRM9zRPDDKPttYT61n0TdWkAAjggk9AhuxIeaXd69CYTcsGw7cBTakLVbNpRzGEgyWjkSOpMbZXkhGL6oX30R49qt3GoHrap7i0XdD41WQ+2icCNm5p1hmFqnHNlcla0riKmDZ183crDxChjbnurtxHPRE784sVhWvDfGP+SsTKibU3o5NtWHuZFGZOxP6P5VXqIOvaOSec4eYohyd7NslHuJbd1bewds85xYrNxkr2d+5IhFWF3NvaO684xjE2S5ulY+tu64Pna0fCPJgzw6vF5/WucLcYjt5xoq19O3UDptOg/OamJQRaCcPPnMTQ2QDFn+uhPvUfnCrMc99upyQY4Ui9Dlc/YoG3R/v4Cs9YE+g==","host":"grpcbin.test.k6.io","message":"{}","metadata":{},"method":"Index","port":9000,"service":"grpcbin.GRPCBin"},"retry":{"count":0,"interval":300},"subtype":"grpc","id":"6w8-xwm-qki"}]},"message":"BDD
19-
test payload: synthetics_api_test_multi_step_payload.json","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_a_FIDO_global_variable_returns_OK_response-1733743057","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"locations":["aws:us-east-2"],"created_by":{"name":null,"handle":"[email protected]","email":"[email protected]"},"deleted_at":null,"monitor_id":159880989,"org_id":321813,"modified_by":{"name":null,"handle":"[email protected]","email":"[email protected]"}}'
16+
string: '{"public_id":"rba-ta9-q2g","name":"Test-Create_a_FIDO_global_variable_returns_OK_response-1740501263","status":"live","type":"api","subtype":"multi","tags":["testing:api"],"created_at":"2025-02-25T16:34:24.599978+00:00","modified_at":"2025-02-25T16:34:24.599978+00:00","config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"exitIfSucceed":true,"extractedValues":[{"field":"server","name":"EXTRACTED_VALUE","parser":{"type":"raw"},"secure":true,"type":"http_header"}],"extractedValuesFromScript":"dd.variable.set(''STATUS_CODE'',
17+
dd.response.statusCode);","isCritical":true,"name":"request is sent","request":{"httpVersion":"http2","method":"GET","timeout":10,"url":"https://datadoghq.com"},"retry":{"count":5,"interval":1000},"subtype":"http","id":"7he-q78-rkr"},{"name":"Wait","subtype":"wait","value":1,"id":"rj2-fyu-8mg"},{"allowFailure":false,"assertions":[{"operator":"lessThan","target":1000,"type":"responseTime"}],"extractedValues":[],"isCritical":true,"name":"GRPC
18+
CALL","request":{"callType":"unary","compressedJsonDescriptor":"eJy1lU1z2yAQhv+Lzj74I3ETH506bQ7OZOSm1w4Wa4epBARQppqM/3v5koCJJdvtxCdW77vPssCO3zMKUgHOFu/ZXvBiS6hZho/f8qe7pftYgXphWJrlA8XwxywEvNba+6PhkC2yVcVVswYp0R6ykRYlZ1SCV21SDrxsssPIeS9FJKqGfK2rqnmmSBwhWa2XlKgtaQPiDcRGCUDVfwGD2sKUqKEtc1cSoOrsMlaMOec1sySYCCgUYRSVLv2zSva2u+FQkB0pVkIw8bFuIudOOn3pOaKYVT3Iy97Pd0AYhOx5QcMsnxvRHlnuLf8ETDd3CNtrv2nejkDpRnANCmGkkFn/hsYzpBKE7jVbufgnKnV9HRM9zRPDDKPttYT61n0TdWkAAjggk9AhuxIeaXd69CYTcsGw7cBTakLVbNpRzGEgyWjkSOpMbZXkhGL6oX30R49qt3GoHrap7i0XdD41WQ+2icCNm5p1hmFqnHNlcla0riKmDZ183crDxChjbnurtxHPRE784sVhWvDfGP+SsTKibU3o5NtWHuZFGZOxP6P5VXqIOvaOSec4eYohyd7NslHuJbd1bewds85xYrNxkr2d+5IhFWF3NvaO684xjE2S5ulY+tu64Pna0fCPJgzw6vF5/WucLcYjt5xoq19O3UDptOg/OamJQRaCcPPnMTQ2QDFn+uhPvUfnCrMc99upyQY4Ui9Dlc/YoG3R/v4Cs9YE+g==","host":"grpcbin.test.k6.io","message":"{}","metadata":{},"method":"Index","port":9000,"service":"grpcbin.GRPCBin"},"retry":{"count":0,"interval":300},"subtype":"grpc","id":"5s9-wdd-awh"}]},"message":"BDD
19+
test payload: synthetics_api_test_multi_step_payload.json","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_a_FIDO_global_variable_returns_OK_response-1740501263","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"locations":["aws:us-east-2"],"created_by":{"name":"CI
20+
Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"[email protected]"},"deleted_at":null,"monitor_id":165393053,"org_id":321813,"modified_by":{"name":"CI
21+
Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"[email protected]"}}'
2022
headers:
2123
content-type:
2224
- application/json
2325
status:
2426
code: 200
2527
message: OK
2628
- request:
27-
body: '{"description":"","is_fido":true,"name":"GLOBAL_VARIABLE_FIDO_PAYLOAD_TESTCREATEAFIDOGLOBALVARIABLERETURNSOKRESPONSE1733743057","tags":[]}'
29+
body: '{"description":"","is_fido":true,"name":"GLOBAL_VARIABLE_FIDO_PAYLOAD_TESTCREATEAFIDOGLOBALVARIABLERETURNSOKRESPONSE1740501263","tags":[]}'
2830
headers:
2931
accept:
3032
- application/json
@@ -34,7 +36,7 @@ interactions:
3436
uri: https://api.datadoghq.com/api/v1/synthetics/variables
3537
response:
3638
body:
37-
string: '{"id":"7e732043-f247-41d4-adff-ccf1624107b7","name":"GLOBAL_VARIABLE_FIDO_PAYLOAD_TESTCREATEAFIDOGLOBALVARIABLERETURNSOKRESPONSE1733743057","description":"","type":"variable","tags":[],"last_error":null,"is_fido":true,"value":{"secure":true}}
39+
string: '{"id":"8cf7404b-d839-4a30-b86e-02158c90d20e","name":"GLOBAL_VARIABLE_FIDO_PAYLOAD_TESTCREATEAFIDOGLOBALVARIABLERETURNSOKRESPONSE1740501263","description":"","type":"variable","tags":[],"last_error":null,"is_fido":true,"value":{"secure":true}}
3840
3941
'
4042
headers:
@@ -49,7 +51,7 @@ interactions:
4951
accept:
5052
- '*/*'
5153
method: DELETE
52-
uri: https://api.datadoghq.com/api/v1/synthetics/variables/7e732043-f247-41d4-adff-ccf1624107b7
54+
uri: https://api.datadoghq.com/api/v1/synthetics/variables/8cf7404b-d839-4a30-b86e-02158c90d20e
5355
response:
5456
body:
5557
string: ''
@@ -60,7 +62,7 @@ interactions:
6062
code: 200
6163
message: OK
6264
- request:
63-
body: '{"public_ids":["2ym-xig-di5"]}'
65+
body: '{"public_ids":["rba-ta9-q2g"]}'
6466
headers:
6567
accept:
6668
- application/json
@@ -70,7 +72,7 @@ interactions:
7072
uri: https://api.datadoghq.com/api/v1/synthetics/tests/delete
7173
response:
7274
body:
73-
string: '{"deleted_tests":[{"public_id":"2ym-xig-di5","deleted_at":"2024-12-09T11:17:40.588357+00:00"}]}
75+
string: '{"deleted_tests":[{"public_id":"rba-ta9-q2g","deleted_at":"2025-02-25T16:34:26.535007+00:00"}]}
7476
7577
'
7678
headers:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-12-09T11:17:49.290Z
1+
2025-02-25T16:34:29.813Z

0 commit comments

Comments
 (0)