Skip to content

Add httpVersion option to Synthetics API tests #1300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2023-01-11 12:48:12.815518",
"spec_repo_commit": "c986b09e"
"regenerated": "2023-01-12 19:46:01.914657",
"spec_repo_commit": "8506d30d"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-01-11 12:48:12.830143",
"spec_repo_commit": "c986b09e"
"regenerated": "2023-01-12 19:46:01.928978",
"spec_repo_commit": "8506d30d"
}
}
}
13 changes: 13 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13449,6 +13449,8 @@ components:
follow_redirects:
description: For API HTTP test, whether or not the test should follow redirects.
type: boolean
httpVersion:
$ref: '#/components/schemas/SyntheticsTestOptionsHTTPVersion'
ignoreServerCertificateError:
description: Ignore server certificate error for browser tests.
type: boolean
Expand Down Expand Up @@ -13495,6 +13497,17 @@ components:
minimum: 30
type: integer
type: object
SyntheticsTestOptionsHTTPVersion:
description: HTTP version to use for a Synthetic test.
enum:
- http1
- http2
- any
type: string
x-enum-varnames:
- HTTP1
- HTTP2
- ANY
SyntheticsTestOptionsMonitorOptions:
description: 'Object containing the options for a Synthetic test as a monitor

Expand Down
2 changes: 2 additions & 0 deletions examples/v1/synthetics/CreateSyntheticsAPITest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from datadog_api_client.v1.model.synthetics_test_details_sub_type import SyntheticsTestDetailsSubType
from datadog_api_client.v1.model.synthetics_test_execution_rule import SyntheticsTestExecutionRule
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_http_version import SyntheticsTestOptionsHTTPVersion
from datadog_api_client.v1.model.synthetics_test_options_monitor_options import SyntheticsTestOptionsMonitorOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_pause_status import SyntheticsTestPauseStatus
Expand Down Expand Up @@ -48,6 +49,7 @@
device_ids=[
SyntheticsDeviceID.LAPTOP_LARGE,
],
http_version=SyntheticsTestOptionsHTTPVersion.HTTP1,
monitor_options=SyntheticsTestOptionsMonitorOptions(),
restricted_roles=SyntheticsRestrictedRoles(
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from datadog_api_client.v1.model.synthetics_test_details_sub_type import SyntheticsTestDetailsSubType
from datadog_api_client.v1.model.synthetics_test_headers import SyntheticsTestHeaders
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_http_version import SyntheticsTestOptionsHTTPVersion
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
from datadog_api_client.v1.model.synthetics_test_request_certificate import SyntheticsTestRequestCertificate
Expand Down Expand Up @@ -128,6 +129,7 @@
interval=10.0,
),
tick_every=60,
http_version=SyntheticsTestOptionsHTTPVersion.HTTP2,
),
subtype=SyntheticsTestDetailsSubType.HTTP,
tags=[
Expand Down
2 changes: 2 additions & 0 deletions examples/v1/synthetics/UpdateBrowserTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from datadog_api_client.v1.model.synthetics_test_ci_options import SyntheticsTestCiOptions
from datadog_api_client.v1.model.synthetics_test_execution_rule import SyntheticsTestExecutionRule
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_http_version import SyntheticsTestOptionsHTTPVersion
from datadog_api_client.v1.model.synthetics_test_options_monitor_options import SyntheticsTestOptionsMonitorOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_pause_status import SyntheticsTestPauseStatus
Expand Down Expand Up @@ -79,6 +80,7 @@
device_ids=[
SyntheticsDeviceID.LAPTOP_LARGE,
],
http_version=SyntheticsTestOptionsHTTPVersion.HTTP1,
monitor_options=SyntheticsTestOptionsMonitorOptions(),
restricted_roles=SyntheticsRestrictedRoles(
[
Expand Down
10 changes: 10 additions & 0 deletions src/datadog_api_client/v1/model/synthetics_test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
if TYPE_CHECKING:
from datadog_api_client.v1.model.synthetics_test_ci_options import SyntheticsTestCiOptions
from datadog_api_client.v1.model.synthetics_device_id import SyntheticsDeviceID
from datadog_api_client.v1.model.synthetics_test_options_http_version import SyntheticsTestOptionsHTTPVersion
from datadog_api_client.v1.model.synthetics_test_options_monitor_options import SyntheticsTestOptionsMonitorOptions
from datadog_api_client.v1.model.synthetics_restricted_roles import SyntheticsRestrictedRoles
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
Expand All @@ -38,6 +39,7 @@ class SyntheticsTestOptions(ModelNormal):
def openapi_types(_):
from datadog_api_client.v1.model.synthetics_test_ci_options import SyntheticsTestCiOptions
from datadog_api_client.v1.model.synthetics_device_id import SyntheticsDeviceID
from datadog_api_client.v1.model.synthetics_test_options_http_version import SyntheticsTestOptionsHTTPVersion
from datadog_api_client.v1.model.synthetics_test_options_monitor_options import (
SyntheticsTestOptionsMonitorOptions,
)
Expand All @@ -54,6 +56,7 @@ def openapi_types(_):
"disable_cors": (bool,),
"disable_csp": (bool,),
"follow_redirects": (bool,),
"http_version": (SyntheticsTestOptionsHTTPVersion,),
"ignore_server_certificate_error": (bool,),
"initial_navigation_timeout": (int,),
"min_failure_duration": (int,),
Expand All @@ -77,6 +80,7 @@ def openapi_types(_):
"disable_cors": "disableCors",
"disable_csp": "disableCsp",
"follow_redirects": "follow_redirects",
"http_version": "httpVersion",
"ignore_server_certificate_error": "ignoreServerCertificateError",
"initial_navigation_timeout": "initialNavigationTimeout",
"min_failure_duration": "min_failure_duration",
Expand All @@ -101,6 +105,7 @@ def __init__(
disable_cors: Union[bool, UnsetType] = unset,
disable_csp: Union[bool, UnsetType] = unset,
follow_redirects: Union[bool, UnsetType] = unset,
http_version: Union[SyntheticsTestOptionsHTTPVersion, UnsetType] = unset,
ignore_server_certificate_error: Union[bool, UnsetType] = unset,
initial_navigation_timeout: Union[int, UnsetType] = unset,
min_failure_duration: Union[int, UnsetType] = unset,
Expand Down Expand Up @@ -143,6 +148,9 @@ def __init__(
:param follow_redirects: For API HTTP test, whether or not the test should follow redirects.
:type follow_redirects: bool, optional

:param http_version: HTTP version to use for a Synthetic test.
:type http_version: SyntheticsTestOptionsHTTPVersion, optional

:param ignore_server_certificate_error: Ignore server certificate error for browser tests.
:type ignore_server_certificate_error: bool, optional

Expand Down Expand Up @@ -207,6 +215,8 @@ def __init__(
kwargs["disable_csp"] = disable_csp
if follow_redirects is not unset:
kwargs["follow_redirects"] = follow_redirects
if http_version is not unset:
kwargs["http_version"] = http_version
if ignore_server_certificate_error is not unset:
kwargs["ignore_server_certificate_error"] = ignore_server_certificate_error
if initial_navigation_timeout is not unset:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 SyntheticsTestOptionsHTTPVersion(ModelSimple):
"""
HTTP version to use for a Synthetic test.

:param value: Must be one of ["http1", "http2", "any"].
:type value: str
"""

allowed_values = {
"http1",
"http2",
"any",
}
HTTP1: ClassVar["SyntheticsTestOptionsHTTPVersion"]
HTTP2: ClassVar["SyntheticsTestOptionsHTTPVersion"]
ANY: ClassVar["SyntheticsTestOptionsHTTPVersion"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


SyntheticsTestOptionsHTTPVersion.HTTP1 = SyntheticsTestOptionsHTTPVersion("http1")
SyntheticsTestOptionsHTTPVersion.HTTP2 = SyntheticsTestOptionsHTTPVersion("http2")
SyntheticsTestOptionsHTTPVersion.ANY = SyntheticsTestOptionsHTTPVersion("any")
1 change: 1 addition & 0 deletions src/datadog_api_client/v1/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@
from datadog_api_client.v1.model.synthetics_test_metadata import SyntheticsTestMetadata
from datadog_api_client.v1.model.synthetics_test_monitor_status import SyntheticsTestMonitorStatus
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_http_version import SyntheticsTestOptionsHTTPVersion
from datadog_api_client.v1.model.synthetics_test_options_monitor_options import SyntheticsTestOptionsMonitorOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_pause_status import SyntheticsTestPauseStatus
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-11-14T14:48:36.716Z
2023-01-11T22:23:00.967Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: '{"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":{"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":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1668437316"},"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-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1668437316","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1668437316","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"}'
body: '{"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":{"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":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1673475780"},"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-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1673475780","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_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1673475780","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"}'
headers:
accept:
- application/json
Expand All @@ -11,17 +11,17 @@ interactions:
uri: https://api.datadoghq.com/api/v1/synthetics/tests/api
response:
body:
string: '{"status":"live","public_id":"5uy-n93-2fv","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-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1668437316","monitor_id":102936713,"type":"api","created_at":"2022-11-14T14:48:37.216855+00:00","modified_at":"2022-11-14T14:48:37.216855+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","basicAuth":{"clientSecret":"client-secret","resource":"resource","accessTokenUrl":"https://datadog-token.com","audience":"audience","clientId":"client-id","scope":"yoyo","type":"oauth-client","tokenApiAuthentication":"header"},"headers":{"unique":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1668437316"},"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-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1668437316","tick_every":60}}'
string: '{"status":"live","public_id":"v95-t96-e52","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-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1673475780","monitor_id":107572226,"type":"api","created_at":"2023-01-11T22:23:01.221860+00:00","modified_at":"2023-01-11T22:23:01.221860+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","basicAuth":{"clientSecret":"client-secret","resource":"resource","accessTokenUrl":"https://datadog-token.com","audience":"audience","clientId":"client-id","scope":"yoyo","type":"oauth-client","tokenApiAuthentication":"header"},"headers":{"unique":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1673475780"},"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-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1673475780","tick_every":60,"httpVersion":"http2"}}'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: '{"public_ids":["5uy-n93-2fv"]}'
body: '{"public_ids":["v95-t96-e52"]}'
headers:
accept:
- application/json
Expand All @@ -31,7 +31,7 @@ interactions:
uri: https://api.datadoghq.com/api/v1/synthetics/tests/delete
response:
body:
string: '{"deleted_tests":[{"deleted_at":"2022-11-14T14:48:37.728729+00:00","public_id":"5uy-n93-2fv"}]}
string: '{"deleted_tests":[{"deleted_at":"2023-01-11T22:23:01.652785+00:00","public_id":"v95-t96-e52"}]}

'
headers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-11-21T13:20:13.404Z
2023-01-11T22:27:11.207Z
Loading