Skip to content

Commit 24b6ebb

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add support for xpath assertions in synthetics tests (#876)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 16a5b50 commit 24b6ebb

File tree

19 files changed

+301
-100
lines changed

19 files changed

+301
-100
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.4",
7-
"regenerated": "2022-11-04 18:42:23.483568",
8-
"spec_repo_commit": "af3f11fc"
7+
"regenerated": "2022-11-08 09:49:27.755753",
8+
"spec_repo_commit": "9146e44b"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2022-11-04 18:42:23.501734",
13-
"spec_repo_commit": "af3f11fc"
12+
"regenerated": "2022-11-08 09:49:27.768024",
13+
"spec_repo_commit": "9146e44b"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11299,6 +11299,7 @@ components:
1129911299
oneOf:
1130011300
- $ref: '#/components/schemas/SyntheticsAssertionTarget'
1130111301
- $ref: '#/components/schemas/SyntheticsAssertionJSONPathTarget'
11302+
- $ref: '#/components/schemas/SyntheticsAssertionXPathTarget'
1130211303
type: object
1130311304
SyntheticsAssertionJSONPathOperator:
1130411305
description: Assertion operator to apply.
@@ -11428,6 +11429,42 @@ components:
1142811429
- RECEIVED_MESSAGE
1142911430
- GRPC_HEALTHCHECK_STATUS
1143011431
- CONNECTION
11432+
SyntheticsAssertionXPathOperator:
11433+
description: Assertion operator to apply.
11434+
enum:
11435+
- validatesXPath
11436+
example: validatesXPath
11437+
type: string
11438+
x-enum-varnames:
11439+
- VALIDATES_X_PATH
11440+
SyntheticsAssertionXPathTarget:
11441+
description: An assertion for the `validatesXPath` operator.
11442+
properties:
11443+
operator:
11444+
$ref: '#/components/schemas/SyntheticsAssertionXPathOperator'
11445+
property:
11446+
description: The associated assertion property.
11447+
type: string
11448+
target:
11449+
$ref: '#/components/schemas/SyntheticsAssertionXPathTargetTarget'
11450+
type:
11451+
$ref: '#/components/schemas/SyntheticsAssertionType'
11452+
required:
11453+
- type
11454+
- operator
11455+
type: object
11456+
SyntheticsAssertionXPathTargetTarget:
11457+
description: Composed target for `validatesXPath` operator.
11458+
properties:
11459+
operator:
11460+
description: The specific operator to use on the path.
11461+
type: string
11462+
targetValue:
11463+
description: The path target value to compare to.
11464+
xPath:
11465+
description: The X path to assert.
11466+
type: string
11467+
type: object
1143111468
SyntheticsBasicAuth:
1143211469
description: Object to handle basic authentication when performing the test.
1143311470
oneOf:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"2022-02-22T17:12:27.896Z"
1+
"2022-11-08T09:31:12.771Z"

cassettes/v1/Monitors_4022238206/Get-a-synthetics-monitor-s-details_2292154114/recording.har

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
},
99
"entries": [
1010
{
11-
"_id": "780b671d6d5f7fb7ad17ba2f4a26da62",
11+
"_id": "2abd75f59b0d9f67de34929ac9a992b2",
1212
"_order": 0,
1313
"cache": {},
1414
"request": {
15-
"bodySize": 1277,
15+
"bodySize": 1395,
1616
"cookies": [],
1717
"headers": [
1818
{
@@ -32,17 +32,17 @@
3232
"postData": {
3333
"mimeType": "application/json",
3434
"params": [],
35-
"text": "{\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"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\":\"testgetasyntheticsmonitorsdetails1645549947\"},\"method\":\"GET\",\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"name\":\"Test-Get_a_synthetics_monitor_s_details-1645549947\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Get_a_synthetics_monitor_s_details-1645549947\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"type\":\"api\"}"
35+
"text": "{\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"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\":\"testgetasyntheticsmonitorsdetails1667899872\"},\"method\":\"GET\",\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"name\":\"Test-Get_a_synthetics_monitor_s_details-1667899872\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Get_a_synthetics_monitor_s_details-1667899872\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"type\":\"api\"}"
3636
},
3737
"queryString": [],
3838
"url": "https://api.datadoghq.com/api/v1/synthetics/tests/api"
3939
},
4040
"response": {
41-
"bodySize": 1423,
41+
"bodySize": 1543,
4242
"content": {
4343
"mimeType": "application/json",
44-
"size": 1423,
45-
"text": "{\"status\":\"live\",\"public_id\":\"87q-fuj-j2g\",\"tags\":[\"testing:api\"],\"org_id\":321813,\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"deleted_at\":null,\"name\":\"Test-Get_a_synthetics_monitor_s_details-1645549947\",\"monitor_id\":64654478,\"type\":\"api\",\"created_at\":\"2022-02-22T17:12:28.762647+00:00\",\"modified_at\":\"2022-02-22T17:12:28.762647+00:00\",\"subtype\":\"http\",\"config\":{\"request\":{\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"url\":\"https://datadoghq.com\",\"headers\":{\"unique\":\"testgetasyntheticsmonitorsdetails1645549947\"},\"proxy\":{\"url\":\"https://datadoghq.com\",\"headers\":{}},\"timeout\":10,\"method\":\"GET\"},\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"type\":\"header\",\"target\":\"text/html\"},{\"operator\":\"lessThan\",\"type\":\"responseTime\",\"target\":2000},{\"operator\":\"validatesJSONPath\",\"type\":\"body\",\"target\":{\"operator\":\"isNot\",\"targetValue\":\"0\",\"jsonPath\":\"topKey\"}}],\"configVariables\":[{\"pattern\":\"content-type\",\"type\":\"text\",\"example\":\"content-type\",\"name\":\"PROPERTY\"}]},\"options\":{\"accept_self_signed\":false,\"retry\":{\"count\":3,\"interval\":10},\"min_location_failed\":1,\"allow_insecure\":true,\"follow_redirects\":true,\"min_failure_duration\":10,\"monitor_priority\":5,\"monitor_name\":\"Test-Get_a_synthetics_monitor_s_details-1645549947\",\"tick_every\":60}}"
44+
"size": 1543,
45+
"text": "{\"status\":\"live\",\"public_id\":\"2ud-5q9-dwc\",\"tags\":[\"testing:api\"],\"org_id\":569509,\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"deleted_at\":null,\"name\":\"Test-Get_a_synthetics_monitor_s_details-1667899872\",\"monitor_id\":102332053,\"type\":\"api\",\"created_at\":\"2022-11-08T09:31:13.173822+00:00\",\"modified_at\":\"2022-11-08T09:31:13.173822+00:00\",\"subtype\":\"http\",\"config\":{\"request\":{\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"url\":\"https://datadoghq.com\",\"headers\":{\"unique\":\"testgetasyntheticsmonitorsdetails1667899872\"},\"proxy\":{\"url\":\"https://datadoghq.com\",\"headers\":{}},\"timeout\":10,\"method\":\"GET\"},\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"type\":\"header\",\"target\":\"text/html\"},{\"operator\":\"lessThan\",\"type\":\"responseTime\",\"target\":2000},{\"operator\":\"validatesJSONPath\",\"type\":\"body\",\"target\":{\"operator\":\"isNot\",\"targetValue\":\"0\",\"jsonPath\":\"topKey\"}},{\"operator\":\"validatesXPath\",\"type\":\"body\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"}}],\"configVariables\":[{\"pattern\":\"content-type\",\"type\":\"text\",\"example\":\"content-type\",\"name\":\"PROPERTY\"}]},\"options\":{\"accept_self_signed\":false,\"retry\":{\"count\":3,\"interval\":10},\"min_location_failed\":1,\"allow_insecure\":true,\"follow_redirects\":true,\"min_failure_duration\":10,\"monitor_priority\":5,\"monitor_name\":\"Test-Get_a_synthetics_monitor_s_details-1667899872\",\"tick_every\":60}}"
4646
},
4747
"cookies": [],
4848
"headers": [
@@ -51,17 +51,17 @@
5151
"value": "application/json"
5252
}
5353
],
54-
"headersSize": 667,
54+
"headersSize": 624,
5555
"httpVersion": "HTTP/1.1",
5656
"redirectURL": "",
5757
"status": 200,
5858
"statusText": "OK"
5959
},
60-
"startedDateTime": "2022-02-22T17:12:27.918Z",
61-
"time": 772
60+
"startedDateTime": "2022-11-08T09:31:12.775Z",
61+
"time": 459
6262
},
6363
{
64-
"_id": "8cc44902c434773b34d8472888e08f66",
64+
"_id": "038f7b09fa1a745b5afbbb3784faebaf",
6565
"_order": 0,
6666
"cache": {},
6767
"request": {
@@ -74,18 +74,18 @@
7474
"value": "application/json"
7575
}
7676
],
77-
"headersSize": 507,
77+
"headersSize": 508,
7878
"httpVersion": "HTTP/1.1",
7979
"method": "GET",
8080
"queryString": [],
81-
"url": "https://api.datadoghq.com/api/v1/monitor/64654478"
81+
"url": "https://api.datadoghq.com/api/v1/monitor/102332053"
8282
},
8383
"response": {
84-
"bodySize": 816,
84+
"bodySize": 815,
8585
"content": {
8686
"mimeType": "application/json",
87-
"size": 816,
88-
"text": "{\"restricted_roles\":null,\"tags\":[\"testing:api\",\"probe_dc:aws:us-east-2\",\"check_type:api\",\"check_status:live\",\"ci_execution_rule:blocking\"],\"deleted\":null,\"query\":\"no_query\",\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"id\":64654478,\"multi\":false,\"name\":\"Test-Get_a_synthetics_monitor_s_details-1645549947\",\"created\":\"2022-02-22T17:12:28.732932+00:00\",\"created_at\":1645549948000,\"creator\":{\"id\":1445416,\"handle\":\"[email protected]\",\"name\":null,\"email\":\"[email protected]\"},\"org_id\":321813,\"modified\":\"2022-02-22T17:12:28.732932+00:00\",\"priority\":5,\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"type\":\"synthetics alert\",\"options\":{\"notify_audit\":false,\"locked\":false,\"silenced\":{},\"include_tags\":true,\"new_host_delay\":300,\"notify_no_data\":false,\"synthetics_check_id\":\"87q-fuj-j2g\"}}"
87+
"size": 815,
88+
"text": "{\"restricted_roles\":null,\"tags\":[\"testing:api\",\"probe_dc:aws:us-east-2\",\"check_type:api\",\"check_status:live\",\"ci_execution_rule:blocking\"],\"deleted\":null,\"query\":\"no_query\",\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"id\":102332053,\"multi\":false,\"name\":\"Test-Get_a_synthetics_monitor_s_details-1667899872\",\"created\":\"2022-11-08T09:31:13.159457+00:00\",\"created_at\":1667899873000,\"creator\":{\"id\":2781302,\"handle\":\"[email protected]\",\"name\":\"Frog\",\"email\":\"[email protected]\"},\"org_id\":569509,\"modified\":\"2022-11-08T09:31:13.159457+00:00\",\"priority\":5,\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"type\":\"synthetics alert\",\"options\":{\"notify_audit\":false,\"synthetics_check_id\":\"2ud-5q9-dwc\",\"silenced\":{},\"include_tags\":true,\"new_host_delay\":300,\"on_missing_data\":\"show_no_data\"}}\n"
8989
},
9090
"cookies": [],
9191
"headers": [
@@ -94,17 +94,17 @@
9494
"value": "application/json"
9595
}
9696
],
97-
"headersSize": 665,
97+
"headersSize": 622,
9898
"httpVersion": "HTTP/1.1",
9999
"redirectURL": "",
100100
"status": 200,
101101
"statusText": "OK"
102102
},
103-
"startedDateTime": "2022-02-22T17:12:28.697Z",
104-
"time": 502
103+
"startedDateTime": "2022-11-08T09:31:13.241Z",
104+
"time": 361
105105
},
106106
{
107-
"_id": "fa3ec63ad4ec0f090db7f3baf22fed5b",
107+
"_id": "abc4c92ebb30d612408ca4e000cef756",
108108
"_order": 0,
109109
"cache": {},
110110
"request": {
@@ -128,17 +128,17 @@
128128
"postData": {
129129
"mimeType": "application/json",
130130
"params": [],
131-
"text": "{\"public_ids\":[\"87q-fuj-j2g\"]}"
131+
"text": "{\"public_ids\":[\"2ud-5q9-dwc\"]}"
132132
},
133133
"queryString": [],
134134
"url": "https://api.datadoghq.com/api/v1/synthetics/tests/delete"
135135
},
136136
"response": {
137-
"bodySize": 95,
137+
"bodySize": 96,
138138
"content": {
139139
"mimeType": "application/json",
140-
"size": 95,
141-
"text": "{\"deleted_tests\":[{\"deleted_at\":\"2022-02-22T17:12:29.793575+00:00\",\"public_id\":\"87q-fuj-j2g\"}]}"
140+
"size": 96,
141+
"text": "{\"deleted_tests\":[{\"deleted_at\":\"2022-11-08T09:31:13.936142+00:00\",\"public_id\":\"2ud-5q9-dwc\"}]}\n"
142142
},
143143
"cookies": [],
144144
"headers": [
@@ -147,14 +147,14 @@
147147
"value": "application/json"
148148
}
149149
],
150-
"headersSize": 665,
150+
"headersSize": 622,
151151
"httpVersion": "HTTP/1.1",
152152
"redirectURL": "",
153153
"status": 200,
154154
"statusText": "OK"
155155
},
156-
"startedDateTime": "2022-02-22T17:12:29.205Z",
157-
"time": 637
156+
"startedDateTime": "2022-11-08T09:31:13.610Z",
157+
"time": 419
158158
}
159159
],
160160
"pages": [],
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"2022-08-30T12:59:04.595Z"
1+
"2022-11-07T13:42:32.570Z"

0 commit comments

Comments
 (0)