From 765721b2eb23d736f949fcc01357d247bd1ceaf9 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 10 Jun 2024 14:08:54 +0000 Subject: [PATCH] Regenerate client from commit eaf0da43 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v1/openapi.yaml | 36 ++++ api/datadogV1/model_synthetics_assertion.go | 32 ++++ ...synthetics_assertion_body_hash_operator.go | 68 +++++++ ...l_synthetics_assertion_body_hash_target.go | 179 ++++++++++++++++++ ...del_synthetics_assertion_body_hash_type.go | 64 +++++++ .../CreateSyntheticsAPITest_1487281163.go | 6 + .../CreateSyntheticsAPITest_1987645492.go | 154 +++++++++++++++ ...o_Get_a_synthetics_monitors_details.freeze | 2 +- ...rio_Get_a_synthetics_monitors_details.yaml | 22 ++- ...I_HTTP_test_has_bodyHash_filled_out.freeze | 1 + ...API_HTTP_test_has_bodyHash_filled_out.yaml | 47 +++++ ..._the_created_test_details._response.freeze | 2 +- ...ns_the_created_test_details._response.yaml | 14 +- ...dit_an_API_test_returns_OK_response.freeze | 2 +- ..._Edit_an_API_test_returns_OK_response.yaml | 26 +-- ..._Synthetic_test_returns_OK_response.freeze | 2 +- ..._a_Synthetic_test_returns_OK_response.yaml | 24 ++- ...Synthetic_tests_returns_OK_response.freeze | 2 +- ...r_Synthetic_tests_returns_OK_response.yaml | 18 +- tests/scenarios/features/v1/given.json | 2 +- .../scenarios/features/v1/synthetics.feature | 10 + .../v1/synthetics_api_http_test_payload.json | 5 + 23 files changed, 671 insertions(+), 55 deletions(-) create mode 100644 api/datadogV1/model_synthetics_assertion_body_hash_operator.go create mode 100644 api/datadogV1/model_synthetics_assertion_body_hash_target.go create mode 100644 api/datadogV1/model_synthetics_assertion_body_hash_type.go create mode 100644 examples/v1/synthetics/CreateSyntheticsAPITest_1987645492.go create mode 100644 tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_has_bodyHash_filled_out.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_has_bodyHash_filled_out.yaml diff --git a/.apigentools-info b/.apigentools-info index 762133d90b2..60baab14a12 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-06-07 12:30:45.560911", - "spec_repo_commit": "93296fc6" + "regenerated": "2024-06-10 14:07:10.655609", + "spec_repo_commit": "eaf0da43" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-06-07 12:30:45.578596", - "spec_repo_commit": "93296fc6" + "regenerated": "2024-06-10 14:07:10.710587", + "spec_repo_commit": "eaf0da43" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 67a52c4bc05..e6878d4cd62 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -13693,9 +13693,45 @@ components: which property they apply, and upon which target.' oneOf: - $ref: '#/components/schemas/SyntheticsAssertionTarget' + - $ref: '#/components/schemas/SyntheticsAssertionBodyHashTarget' - $ref: '#/components/schemas/SyntheticsAssertionJSONPathTarget' - $ref: '#/components/schemas/SyntheticsAssertionJSONSchemaTarget' - $ref: '#/components/schemas/SyntheticsAssertionXPathTarget' + SyntheticsAssertionBodyHashOperator: + description: Assertion operator to apply. + enum: + - md5 + - sha1 + - sha256 + example: md5 + type: string + x-enum-varnames: + - MD5 + - SHA1 + - SHA256 + SyntheticsAssertionBodyHashTarget: + description: An assertion which targets body hash. + properties: + operator: + $ref: '#/components/schemas/SyntheticsAssertionBodyHashOperator' + target: + description: Value used by the operator. + example: 123456 + type: + $ref: '#/components/schemas/SyntheticsAssertionBodyHashType' + required: + - type + - operator + - target + type: object + SyntheticsAssertionBodyHashType: + description: Type of the assertion. + enum: + - bodyHash + example: bodyHash + type: string + x-enum-varnames: + - BODY_HASH SyntheticsAssertionJSONPathOperator: description: Assertion operator to apply. enum: diff --git a/api/datadogV1/model_synthetics_assertion.go b/api/datadogV1/model_synthetics_assertion.go index 018f663641a..8ec62a42926 100644 --- a/api/datadogV1/model_synthetics_assertion.go +++ b/api/datadogV1/model_synthetics_assertion.go @@ -12,6 +12,7 @@ import ( // which property they apply, and upon which target. type SyntheticsAssertion struct { SyntheticsAssertionTarget *SyntheticsAssertionTarget + SyntheticsAssertionBodyHashTarget *SyntheticsAssertionBodyHashTarget SyntheticsAssertionJSONPathTarget *SyntheticsAssertionJSONPathTarget SyntheticsAssertionJSONSchemaTarget *SyntheticsAssertionJSONSchemaTarget SyntheticsAssertionXPathTarget *SyntheticsAssertionXPathTarget @@ -25,6 +26,11 @@ func SyntheticsAssertionTargetAsSyntheticsAssertion(v *SyntheticsAssertionTarget return SyntheticsAssertion{SyntheticsAssertionTarget: v} } +// SyntheticsAssertionBodyHashTargetAsSyntheticsAssertion is a convenience function that returns SyntheticsAssertionBodyHashTarget wrapped in SyntheticsAssertion. +func SyntheticsAssertionBodyHashTargetAsSyntheticsAssertion(v *SyntheticsAssertionBodyHashTarget) SyntheticsAssertion { + return SyntheticsAssertion{SyntheticsAssertionBodyHashTarget: v} +} + // SyntheticsAssertionJSONPathTargetAsSyntheticsAssertion is a convenience function that returns SyntheticsAssertionJSONPathTarget wrapped in SyntheticsAssertion. func SyntheticsAssertionJSONPathTargetAsSyntheticsAssertion(v *SyntheticsAssertionJSONPathTarget) SyntheticsAssertion { return SyntheticsAssertion{SyntheticsAssertionJSONPathTarget: v} @@ -61,6 +67,23 @@ func (obj *SyntheticsAssertion) UnmarshalJSON(data []byte) error { obj.SyntheticsAssertionTarget = nil } + // try to unmarshal data into SyntheticsAssertionBodyHashTarget + err = datadog.Unmarshal(data, &obj.SyntheticsAssertionBodyHashTarget) + if err == nil { + if obj.SyntheticsAssertionBodyHashTarget != nil && obj.SyntheticsAssertionBodyHashTarget.UnparsedObject == nil { + jsonSyntheticsAssertionBodyHashTarget, _ := datadog.Marshal(obj.SyntheticsAssertionBodyHashTarget) + if string(jsonSyntheticsAssertionBodyHashTarget) == "{}" { // empty struct + obj.SyntheticsAssertionBodyHashTarget = nil + } else { + match++ + } + } else { + obj.SyntheticsAssertionBodyHashTarget = nil + } + } else { + obj.SyntheticsAssertionBodyHashTarget = nil + } + // try to unmarshal data into SyntheticsAssertionJSONPathTarget err = datadog.Unmarshal(data, &obj.SyntheticsAssertionJSONPathTarget) if err == nil { @@ -115,6 +138,7 @@ func (obj *SyntheticsAssertion) UnmarshalJSON(data []byte) error { if match != 1 { // more than 1 match // reset to nil obj.SyntheticsAssertionTarget = nil + obj.SyntheticsAssertionBodyHashTarget = nil obj.SyntheticsAssertionJSONPathTarget = nil obj.SyntheticsAssertionJSONSchemaTarget = nil obj.SyntheticsAssertionXPathTarget = nil @@ -129,6 +153,10 @@ func (obj SyntheticsAssertion) MarshalJSON() ([]byte, error) { return datadog.Marshal(&obj.SyntheticsAssertionTarget) } + if obj.SyntheticsAssertionBodyHashTarget != nil { + return datadog.Marshal(&obj.SyntheticsAssertionBodyHashTarget) + } + if obj.SyntheticsAssertionJSONPathTarget != nil { return datadog.Marshal(&obj.SyntheticsAssertionJSONPathTarget) } @@ -153,6 +181,10 @@ func (obj *SyntheticsAssertion) GetActualInstance() interface{} { return obj.SyntheticsAssertionTarget } + if obj.SyntheticsAssertionBodyHashTarget != nil { + return obj.SyntheticsAssertionBodyHashTarget + } + if obj.SyntheticsAssertionJSONPathTarget != nil { return obj.SyntheticsAssertionJSONPathTarget } diff --git a/api/datadogV1/model_synthetics_assertion_body_hash_operator.go b/api/datadogV1/model_synthetics_assertion_body_hash_operator.go new file mode 100644 index 00000000000..9469c5efa02 --- /dev/null +++ b/api/datadogV1/model_synthetics_assertion_body_hash_operator.go @@ -0,0 +1,68 @@ +// 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. + +package datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsAssertionBodyHashOperator Assertion operator to apply. +type SyntheticsAssertionBodyHashOperator string + +// List of SyntheticsAssertionBodyHashOperator. +const ( + SYNTHETICSASSERTIONBODYHASHOPERATOR_MD5 SyntheticsAssertionBodyHashOperator = "md5" + SYNTHETICSASSERTIONBODYHASHOPERATOR_SHA1 SyntheticsAssertionBodyHashOperator = "sha1" + SYNTHETICSASSERTIONBODYHASHOPERATOR_SHA256 SyntheticsAssertionBodyHashOperator = "sha256" +) + +var allowedSyntheticsAssertionBodyHashOperatorEnumValues = []SyntheticsAssertionBodyHashOperator{ + SYNTHETICSASSERTIONBODYHASHOPERATOR_MD5, + SYNTHETICSASSERTIONBODYHASHOPERATOR_SHA1, + SYNTHETICSASSERTIONBODYHASHOPERATOR_SHA256, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsAssertionBodyHashOperator) GetAllowedValues() []SyntheticsAssertionBodyHashOperator { + return allowedSyntheticsAssertionBodyHashOperatorEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsAssertionBodyHashOperator) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsAssertionBodyHashOperator(value) + return nil +} + +// NewSyntheticsAssertionBodyHashOperatorFromValue returns a pointer to a valid SyntheticsAssertionBodyHashOperator +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsAssertionBodyHashOperatorFromValue(v string) (*SyntheticsAssertionBodyHashOperator, error) { + ev := SyntheticsAssertionBodyHashOperator(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsAssertionBodyHashOperator: valid values are %v", v, allowedSyntheticsAssertionBodyHashOperatorEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsAssertionBodyHashOperator) IsValid() bool { + for _, existing := range allowedSyntheticsAssertionBodyHashOperatorEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsAssertionBodyHashOperator value. +func (v SyntheticsAssertionBodyHashOperator) Ptr() *SyntheticsAssertionBodyHashOperator { + return &v +} diff --git a/api/datadogV1/model_synthetics_assertion_body_hash_target.go b/api/datadogV1/model_synthetics_assertion_body_hash_target.go new file mode 100644 index 00000000000..20ea431de43 --- /dev/null +++ b/api/datadogV1/model_synthetics_assertion_body_hash_target.go @@ -0,0 +1,179 @@ +// 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. + +package datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsAssertionBodyHashTarget An assertion which targets body hash. +type SyntheticsAssertionBodyHashTarget struct { + // Assertion operator to apply. + Operator SyntheticsAssertionBodyHashOperator `json:"operator"` + // Value used by the operator. + Target interface{} `json:"target"` + // Type of the assertion. + Type SyntheticsAssertionBodyHashType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewSyntheticsAssertionBodyHashTarget instantiates a new SyntheticsAssertionBodyHashTarget object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSyntheticsAssertionBodyHashTarget(operator SyntheticsAssertionBodyHashOperator, target interface{}, typeVar SyntheticsAssertionBodyHashType) *SyntheticsAssertionBodyHashTarget { + this := SyntheticsAssertionBodyHashTarget{} + this.Operator = operator + this.Target = target + this.Type = typeVar + return &this +} + +// NewSyntheticsAssertionBodyHashTargetWithDefaults instantiates a new SyntheticsAssertionBodyHashTarget object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSyntheticsAssertionBodyHashTargetWithDefaults() *SyntheticsAssertionBodyHashTarget { + this := SyntheticsAssertionBodyHashTarget{} + return &this +} + +// GetOperator returns the Operator field value. +func (o *SyntheticsAssertionBodyHashTarget) GetOperator() SyntheticsAssertionBodyHashOperator { + if o == nil { + var ret SyntheticsAssertionBodyHashOperator + return ret + } + return o.Operator +} + +// GetOperatorOk returns a tuple with the Operator field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionBodyHashTarget) GetOperatorOk() (*SyntheticsAssertionBodyHashOperator, bool) { + if o == nil { + return nil, false + } + return &o.Operator, true +} + +// SetOperator sets field value. +func (o *SyntheticsAssertionBodyHashTarget) SetOperator(v SyntheticsAssertionBodyHashOperator) { + o.Operator = v +} + +// GetTarget returns the Target field value. +func (o *SyntheticsAssertionBodyHashTarget) GetTarget() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionBodyHashTarget) GetTargetOk() (*interface{}, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *SyntheticsAssertionBodyHashTarget) SetTarget(v interface{}) { + o.Target = v +} + +// GetType returns the Type field value. +func (o *SyntheticsAssertionBodyHashTarget) GetType() SyntheticsAssertionBodyHashType { + if o == nil { + var ret SyntheticsAssertionBodyHashType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAssertionBodyHashTarget) GetTypeOk() (*SyntheticsAssertionBodyHashType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SyntheticsAssertionBodyHashTarget) SetType(v SyntheticsAssertionBodyHashType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsAssertionBodyHashTarget) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["operator"] = o.Operator + toSerialize["target"] = o.Target + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsAssertionBodyHashTarget) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Operator *SyntheticsAssertionBodyHashOperator `json:"operator"` + Target *interface{} `json:"target"` + Type *SyntheticsAssertionBodyHashType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Operator == nil { + return fmt.Errorf("required field operator missing") + } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"operator", "target", "type"}) + } else { + return err + } + + hasInvalidField := false + if !all.Operator.IsValid() { + hasInvalidField = true + } else { + o.Operator = *all.Operator + } + o.Target = *all.Target + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV1/model_synthetics_assertion_body_hash_type.go b/api/datadogV1/model_synthetics_assertion_body_hash_type.go new file mode 100644 index 00000000000..9f877c8b872 --- /dev/null +++ b/api/datadogV1/model_synthetics_assertion_body_hash_type.go @@ -0,0 +1,64 @@ +// 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. + +package datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsAssertionBodyHashType Type of the assertion. +type SyntheticsAssertionBodyHashType string + +// List of SyntheticsAssertionBodyHashType. +const ( + SYNTHETICSASSERTIONBODYHASHTYPE_BODY_HASH SyntheticsAssertionBodyHashType = "bodyHash" +) + +var allowedSyntheticsAssertionBodyHashTypeEnumValues = []SyntheticsAssertionBodyHashType{ + SYNTHETICSASSERTIONBODYHASHTYPE_BODY_HASH, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsAssertionBodyHashType) GetAllowedValues() []SyntheticsAssertionBodyHashType { + return allowedSyntheticsAssertionBodyHashTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsAssertionBodyHashType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsAssertionBodyHashType(value) + return nil +} + +// NewSyntheticsAssertionBodyHashTypeFromValue returns a pointer to a valid SyntheticsAssertionBodyHashType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsAssertionBodyHashTypeFromValue(v string) (*SyntheticsAssertionBodyHashType, error) { + ev := SyntheticsAssertionBodyHashType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsAssertionBodyHashType: valid values are %v", v, allowedSyntheticsAssertionBodyHashTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsAssertionBodyHashType) IsValid() bool { + for _, existing := range allowedSyntheticsAssertionBodyHashTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsAssertionBodyHashType value. +func (v SyntheticsAssertionBodyHashType) Ptr() *SyntheticsAssertionBodyHashType { + return &v +} diff --git a/examples/v1/synthetics/CreateSyntheticsAPITest_1487281163.go b/examples/v1/synthetics/CreateSyntheticsAPITest_1487281163.go index b173f32c3ed..6541365b50f 100644 --- a/examples/v1/synthetics/CreateSyntheticsAPITest_1487281163.go +++ b/examples/v1/synthetics/CreateSyntheticsAPITest_1487281163.go @@ -59,6 +59,12 @@ func main() { }, Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY, }}, + datadogV1.SyntheticsAssertion{ + SyntheticsAssertionBodyHashTarget: &datadogV1.SyntheticsAssertionBodyHashTarget{ + Operator: datadogV1.SYNTHETICSASSERTIONBODYHASHOPERATOR_MD5, + Target: "a", + Type: datadogV1.SYNTHETICSASSERTIONBODYHASHTYPE_BODY_HASH, + }}, }, ConfigVariables: []datadogV1.SyntheticsConfigVariable{ { diff --git a/examples/v1/synthetics/CreateSyntheticsAPITest_1987645492.go b/examples/v1/synthetics/CreateSyntheticsAPITest_1987645492.go new file mode 100644 index 00000000000..ff9c2f57085 --- /dev/null +++ b/examples/v1/synthetics/CreateSyntheticsAPITest_1987645492.go @@ -0,0 +1,154 @@ +// Create an API HTTP test has bodyHash filled out + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV1" +) + +func main() { + body := datadogV1.SyntheticsAPITest{ + Config: datadogV1.SyntheticsAPITestConfig{ + Assertions: []datadogV1.SyntheticsAssertion{ + datadogV1.SyntheticsAssertion{ + SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{ + Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS, + Property: datadog.PtrString("{{ PROPERTY }}"), + Target: "text/html", + Type: datadogV1.SYNTHETICSASSERTIONTYPE_HEADER, + }}, + datadogV1.SyntheticsAssertion{ + SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{ + Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_LESS_THAN, + Target: 2000, + Type: datadogV1.SYNTHETICSASSERTIONTYPE_RESPONSE_TIME, + TimingsScope: datadogV1.SYNTHETICSASSERTIONTIMINGSSCOPE_WITHOUT_DNS.Ptr(), + }}, + datadogV1.SyntheticsAssertion{ + SyntheticsAssertionJSONPathTarget: &datadogV1.SyntheticsAssertionJSONPathTarget{ + Operator: datadogV1.SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH, + Target: &datadogV1.SyntheticsAssertionJSONPathTargetTarget{ + JsonPath: datadog.PtrString("topKey"), + Operator: datadog.PtrString("isNot"), + TargetValue: "0", + }, + Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY, + }}, + datadogV1.SyntheticsAssertion{ + SyntheticsAssertionJSONSchemaTarget: &datadogV1.SyntheticsAssertionJSONSchemaTarget{ + Operator: datadogV1.SYNTHETICSASSERTIONJSONSCHEMAOPERATOR_VALIDATES_JSON_SCHEMA, + Target: &datadogV1.SyntheticsAssertionJSONSchemaTargetTarget{ + MetaSchema: datadogV1.SYNTHETICSASSERTIONJSONSCHEMAMETASCHEMA_DRAFT_07.Ptr(), + JsonSchema: datadog.PtrString(`{"type": "object", "properties":{"slideshow":{"type":"object"}}}`), + }, + Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY, + }}, + datadogV1.SyntheticsAssertion{ + SyntheticsAssertionXPathTarget: &datadogV1.SyntheticsAssertionXPathTarget{ + Operator: datadogV1.SYNTHETICSASSERTIONXPATHOPERATOR_VALIDATES_X_PATH, + Target: &datadogV1.SyntheticsAssertionXPathTargetTarget{ + XPath: datadog.PtrString("target-xpath"), + TargetValue: "0", + Operator: datadog.PtrString("contains"), + }, + Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY, + }}, + datadogV1.SyntheticsAssertion{ + SyntheticsAssertionBodyHashTarget: &datadogV1.SyntheticsAssertionBodyHashTarget{ + Operator: datadogV1.SYNTHETICSASSERTIONBODYHASHOPERATOR_MD5, + Target: "a", + Type: datadogV1.SYNTHETICSASSERTIONBODYHASHTYPE_BODY_HASH, + }}, + }, + ConfigVariables: []datadogV1.SyntheticsConfigVariable{ + { + Example: datadog.PtrString("content-type"), + Name: "PROPERTY", + Pattern: datadog.PtrString("content-type"), + Type: datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT, + }, + }, + VariablesFromScript: datadog.PtrString(`dd.variable.set("FOO", "foo")`), + Request: &datadogV1.SyntheticsTestRequest{ + Certificate: &datadogV1.SyntheticsTestRequestCertificate{ + Cert: &datadogV1.SyntheticsTestRequestCertificateItem{ + Content: datadog.PtrString("cert-content"), + Filename: datadog.PtrString("cert-filename"), + UpdatedAt: datadog.PtrString("2020-10-16T09:23:24.857Z"), + }, + Key: &datadogV1.SyntheticsTestRequestCertificateItem{ + Content: datadog.PtrString("key-content"), + Filename: datadog.PtrString("key-filename"), + UpdatedAt: datadog.PtrString("2020-10-16T09:23:24.857Z"), + }, + }, + Headers: map[string]string{ + "unique": "examplesynthetic", + }, + Method: datadog.PtrString("GET"), + Timeout: datadog.PtrFloat64(10), + Url: datadog.PtrString("https://datadoghq.com"), + Proxy: &datadogV1.SyntheticsTestRequestProxy{ + Url: "https://datadoghq.com", + Headers: map[string]string{}, + }, + BasicAuth: &datadogV1.SyntheticsBasicAuth{ + SyntheticsBasicAuthOauthClient: &datadogV1.SyntheticsBasicAuthOauthClient{ + AccessTokenUrl: "https://datadog-token.com", + Audience: datadog.PtrString("audience"), + ClientId: "client-id", + ClientSecret: "client-secret", + Resource: datadog.PtrString("resource"), + Scope: datadog.PtrString("yoyo"), + TokenApiAuthentication: datadogV1.SYNTHETICSBASICAUTHOAUTHTOKENAPIAUTHENTICATION_HEADER, + Type: datadogV1.SYNTHETICSBASICAUTHOAUTHCLIENTTYPE_OAUTH_CLIENT.Ptr(), + }}, + PersistCookies: datadog.PtrBool(true), + }, + }, + Locations: []string{ + "aws:us-east-2", + }, + Message: "BDD test payload: synthetics_api_http_test_payload.json", + Name: "Example-Synthetic", + Options: datadogV1.SyntheticsTestOptions{ + AcceptSelfSigned: datadog.PtrBool(false), + AllowInsecure: datadog.PtrBool(true), + FollowRedirects: datadog.PtrBool(true), + MinFailureDuration: datadog.PtrInt64(10), + MinLocationFailed: datadog.PtrInt64(1), + MonitorName: datadog.PtrString("Example-Synthetic"), + MonitorPriority: datadog.PtrInt32(5), + Retry: &datadogV1.SyntheticsTestOptionsRetry{ + Count: datadog.PtrInt64(3), + Interval: datadog.PtrFloat64(10), + }, + TickEvery: datadog.PtrInt64(60), + HttpVersion: datadogV1.SYNTHETICSTESTOPTIONSHTTPVERSION_HTTP2.Ptr(), + }, + Subtype: datadogV1.SYNTHETICSTESTDETAILSSUBTYPE_HTTP.Ptr(), + Tags: []string{ + "testing:api", + }, + Type: datadogV1.SYNTHETICSAPITESTTYPE_API, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV1.NewSyntheticsApi(apiClient) + resp, r, err := api.CreateSyntheticsAPITest(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreateSyntheticsAPITest`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsAPITest`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Get_a_synthetics_monitors_details.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Get_a_synthetics_monitors_details.freeze index be62d4b7b24..07063790f67 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Get_a_synthetics_monitors_details.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Get_a_synthetics_monitors_details.freeze @@ -1 +1 @@ -2024-04-19T18:06:11.007Z \ No newline at end of file +2024-06-07T17:11:07.876Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Get_a_synthetics_monitors_details.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Get_a_synthetics_monitors_details.yaml index 21109a3eef0..386beb60334 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Get_a_synthetics_monitors_details.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Get_a_synthetics_monitors_details.yaml @@ -1,7 +1,7 @@ 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":"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"}],"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":"testgetasyntheticsmonitorsdetails1713549971"},"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-Get_a_synthetics_monitor_s_details-1713549971","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Get_a_synthetics_monitor_s_details-1713549971","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} + {"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":"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"}],"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":"testgetasyntheticsmonitorsdetails1717780267"},"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-Get_a_synthetics_monitor_s_details-1717780267","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Get_a_synthetics_monitor_s_details-1717780267","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} form: {} headers: Accept: @@ -12,10 +12,12 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/api response: - body: '{"public_id":"vp2-ewh-gtm","name":"Test-Get_a_synthetics_monitor_s_details-1713549971","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-04-19T18:06:11.424005+00:00","modified_at":"2024-04-19T18:06:11.424005+00:00","config":{"assertions":[{"operator":"is","property":"{{ + body: '{"public_id":"345-34e-6z9","name":"Test-Get_a_synthetics_monitor_s_details-1717780267","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-06-07T17:11:08.310477+00:00","modified_at":"2024-06-07T17:11:08.310477+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":"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"}],"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":"testgetasyntheticsmonitorsdetails1713549971"},"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-Get_a_synthetics_monitor_s_details-1713549971","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"deleted_at":null,"monitor_id":143517846,"org_id":321813,"modified_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"}}' + \"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"}],"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":"testgetasyntheticsmonitorsdetails1717780267"},"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-Get_a_synthetics_monitor_s_details-1717780267","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"},"deleted_at":null,"monitor_id":146628223,"org_id":321813,"modified_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"}}' code: 200 duration: 0ms headers: @@ -30,11 +32,11 @@ interactions: - application/json id: 1 method: GET - url: https://api.datadoghq.com/api/v1/monitor/143517846 + url: https://api.datadoghq.com/api/v1/monitor/146628223 response: - body: '{"id":143517846,"org_id":321813,"type":"synthetics alert","name":"Test-Get_a_synthetics_monitor_s_details-1713549971","message":"BDD - test payload: synthetics_api_http_test_payload.json","tags":["testing:api","probe_dc:aws:us-east-2","check_type:api","check_status:live","ci_execution_rule:blocking"],"query":"no_query","options":{"on_missing_data":"show_no_data","notify_audit":false,"new_host_delay":300,"include_tags":true,"synthetics_check_id":"vp2-ewh-gtm","silenced":{}},"multi":false,"created_at":1713549971000,"created":"2024-04-19T18:06:11.399838+00:00","modified":"2024-04-19T18:06:11.399838+00:00","deleted":null,"restricted_roles":null,"priority":5,"overall_state_modified":null,"overall_state":"No - Data","creator":{"name":null,"email":"frog@datadoghq.com","handle":"frog@datadoghq.com","id":1445416}} + body: '{"id":146628223,"org_id":321813,"type":"synthetics alert","name":"Test-Get_a_synthetics_monitor_s_details-1717780267","message":"BDD + test payload: synthetics_api_http_test_payload.json","tags":["testing:api","probe_dc:aws:us-east-2","check_type:api","check_status:live","ci_execution_rule:blocking"],"query":"no_query","options":{"on_missing_data":"show_no_data","notify_audit":false,"new_host_delay":300,"include_tags":true,"synthetics_check_id":"345-34e-6z9","silenced":{}},"multi":false,"created_at":1717780268000,"created":"2024-06-07T17:11:08.287753+00:00","modified":"2024-06-07T17:11:08.287753+00:00","deleted":null,"restricted_roles":null,"priority":5,"overall_state_modified":null,"overall_state":"No + Data","creator":{"name":"CI Account","email":"team-intg-tools-libs-spam@datadoghq.com","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","id":2320499}} ' code: 200 @@ -45,7 +47,7 @@ interactions: status: 200 OK - request: body: | - {"public_ids":["vp2-ewh-gtm"]} + {"public_ids":["345-34e-6z9"]} form: {} headers: Accept: @@ -56,7 +58,7 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/delete response: - body: '{"deleted_tests":[{"public_id":"vp2-ewh-gtm","deleted_at":"2024-04-19T18:06:12.668857+00:00"}]} + body: '{"deleted_tests":[{"public_id":"345-34e-6z9","deleted_at":"2024-06-07T17:11:09.164875+00:00"}]} ' code: 200 diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_has_bodyHash_filled_out.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_has_bodyHash_filled_out.freeze new file mode 100644 index 00000000000..3fc9bf0a78d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_has_bodyHash_filled_out.freeze @@ -0,0 +1 @@ +2024-06-10T13:58:21.100Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_has_bodyHash_filled_out.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_has_bodyHash_filled_out.yaml new file mode 100644 index 00000000000..0da442e6e76 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_has_bodyHash_filled_out.yaml @@ -0,0 +1,47 @@ +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":"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"}],"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":"testcreateanapihttptesthasbodyhashfilledout1718027901"},"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_an_API_HTTP_test_has_bodyHash_filled_out-1718027901","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_has_bodyHash_filled_out-1718027901","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v1/synthetics/tests/api + response: + body: '{"public_id":"4wa-kdy-hav","name":"Test-Create_an_API_HTTP_test_has_bodyHash_filled_out-1718027901","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-06-10T13:58:21.435520+00:00","modified_at":"2024-06-10T13:58:21.435520+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":"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"}],"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":"testcreateanapihttptesthasbodyhashfilledout1718027901"},"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_an_API_HTTP_test_has_bodyHash_filled_out-1718027901","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"deleted_at":null,"monitor_id":146763214,"org_id":321813,"modified_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: | + {"public_ids":["4wa-kdy-hav"]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v1/synthetics/tests/delete + response: + body: '{"deleted_tests":[{"public_id":"4wa-kdy-hav","deleted_at":"2024-06-10T13:58:21.869172+00:00"}]} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_returns_OK_-_Returns_the_created_test_details._response.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_returns_OK_-_Returns_the_created_test_details._response.freeze index 2b4b8f26ff2..03244013244 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_returns_OK_-_Returns_the_created_test_details._response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_returns_OK_-_Returns_the_created_test_details._response.freeze @@ -1 +1 @@ -2024-04-19T18:06:12.804Z \ No newline at end of file +2024-06-07T17:11:09.476Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_returns_OK_-_Returns_the_created_test_details._response.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_returns_OK_-_Returns_the_created_test_details._response.yaml index b26aefe960c..830f290df4c 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_returns_OK_-_Returns_the_created_test_details._response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Create_an_API_HTTP_test_returns_OK_-_Returns_the_created_test_details._response.yaml @@ -1,7 +1,7 @@ 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":"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"}],"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":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1713549972"},"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_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1713549972","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-1713549972","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} + {"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":"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"}],"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":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1717780269"},"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_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1717780269","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-1717780269","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} form: {} headers: Accept: @@ -12,10 +12,12 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/api response: - body: '{"public_id":"ati-q5f-9w7","name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1713549972","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-04-19T18:06:13.121082+00:00","modified_at":"2024-04-19T18:06:13.121082+00:00","config":{"assertions":[{"operator":"is","property":"{{ + body: '{"public_id":"g9k-dug-9pv","name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1717780269","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-06-07T17:11:09.832987+00:00","modified_at":"2024-06-07T17:11:09.832987+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":"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"}],"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":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1713549972"},"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_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1713549972","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"deleted_at":null,"monitor_id":143517847,"org_id":321813,"modified_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"}}' + \"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"}],"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":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1717780269"},"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_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1717780269","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"},"deleted_at":null,"monitor_id":146628225,"org_id":321813,"modified_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"}}' code: 200 duration: 0ms headers: @@ -24,7 +26,7 @@ interactions: status: 200 OK - request: body: | - {"public_ids":["ati-q5f-9w7"]} + {"public_ids":["g9k-dug-9pv"]} form: {} headers: Accept: @@ -35,7 +37,7 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/delete response: - body: '{"deleted_tests":[{"public_id":"ati-q5f-9w7","deleted_at":"2024-04-19T18:06:13.894695+00:00"}]} + body: '{"deleted_tests":[{"public_id":"g9k-dug-9pv","deleted_at":"2024-06-07T17:11:10.468549+00:00"}]} ' code: 200 diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Edit_an_API_test_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Edit_an_API_test_returns_OK_response.freeze index 3605f825579..018e4244847 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Edit_an_API_test_returns_OK_response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Edit_an_API_test_returns_OK_response.freeze @@ -1 +1 @@ -2024-04-19T18:06:14.032Z \ No newline at end of file +2024-06-07T17:11:10.874Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Edit_an_API_test_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Edit_an_API_test_returns_OK_response.yaml index 9a3096792fe..924a15dbf04 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Edit_an_API_test_returns_OK_response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Edit_an_API_test_returns_OK_response.yaml @@ -1,7 +1,7 @@ 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":"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"}],"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":"testeditanapitestreturnsokresponse1713549974"},"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-Edit_an_API_test_returns_OK_response-1713549974","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Edit_an_API_test_returns_OK_response-1713549974","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} + {"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":"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"}],"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":"testeditanapitestreturnsokresponse1717780270"},"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-Edit_an_API_test_returns_OK_response-1717780270","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Edit_an_API_test_returns_OK_response-1717780270","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} form: {} headers: Accept: @@ -12,10 +12,12 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/api response: - body: '{"public_id":"xrn-jgn-wrk","name":"Test-Edit_an_API_test_returns_OK_response-1713549974","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-04-19T18:06:14.401191+00:00","modified_at":"2024-04-19T18:06:14.401191+00:00","config":{"assertions":[{"operator":"is","property":"{{ + body: '{"public_id":"e95-8kp-s23","name":"Test-Edit_an_API_test_returns_OK_response-1717780270","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-06-07T17:11:11.234895+00:00","modified_at":"2024-06-07T17:11:11.234895+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":"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"}],"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":"testeditanapitestreturnsokresponse1713549974"},"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-Edit_an_API_test_returns_OK_response-1713549974","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"deleted_at":null,"monitor_id":143517848,"org_id":321813,"modified_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"}}' + \"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"}],"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":"testeditanapitestreturnsokresponse1717780270"},"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-Edit_an_API_test_returns_OK_response-1717780270","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"},"deleted_at":null,"monitor_id":146628226,"org_id":321813,"modified_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"}}' code: 200 duration: 0ms headers: @@ -24,7 +26,7 @@ interactions: status: 200 OK - 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":"validatesJSONSchema","target":{"jsonSchema":"{\"type\": \"object\", \"properties\":{\"slideshow\":{\"type\":\"object\"}}}","metaSchema":"draft-07"},"type":"body"}],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"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":"testeditanapitestreturnsokresponse1713549974"},"method":"GET","timeout":10,"url":"https://datadoghq.com"}},"locations":["aws:us-east-2"],"message":"BDD test payload: synthetics_api_test_payload.json","name":"Test-Edit_an_API_test_returns_OK_response-1713549974-updated","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-TestSyntheticsAPITestLifecycle-1623076664","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"status":"live","subtype":"http","tags":["testing:api"],"type":"api"} + {"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":"validatesJSONSchema","target":{"jsonSchema":"{\"type\": \"object\", \"properties\":{\"slideshow\":{\"type\":\"object\"}}}","metaSchema":"draft-07"},"type":"body"}],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"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":"testeditanapitestreturnsokresponse1717780270"},"method":"GET","timeout":10,"url":"https://datadoghq.com"}},"locations":["aws:us-east-2"],"message":"BDD test payload: synthetics_api_test_payload.json","name":"Test-Edit_an_API_test_returns_OK_response-1717780270-updated","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-TestSyntheticsAPITestLifecycle-1623076664","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"status":"live","subtype":"http","tags":["testing:api"],"type":"api"} form: {} headers: Accept: @@ -33,12 +35,14 @@ interactions: - application/json id: 1 method: PUT - url: https://api.datadoghq.com/api/v1/synthetics/tests/api/xrn-jgn-wrk + url: https://api.datadoghq.com/api/v1/synthetics/tests/api/e95-8kp-s23 response: - body: '{"public_id":"xrn-jgn-wrk","name":"Test-Edit_an_API_test_returns_OK_response-1713549974-updated","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-04-19T18:06:14.401191+00:00","modified_at":"2024-04-19T18:06:14.817541+00:00","config":{"assertions":[{"operator":"is","property":"{{ + body: '{"public_id":"e95-8kp-s23","name":"Test-Edit_an_API_test_returns_OK_response-1717780270-updated","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-06-07T17:11:11.234895+00:00","modified_at":"2024-06-07T17:11:12.135111+00:00","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":"validatesJSONSchema","target":{"jsonSchema":"{\"type\": - \"object\", \"properties\":{\"slideshow\":{\"type\":\"object\"}}}","metaSchema":"draft-07"},"type":"body"}],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"certificate":{"key":{"filename":"key-filename","updatedAt":"2020-10-16T09:23:24.857Z"},"cert":{"filename":"cert-filename","updatedAt":"2020-10-16T09:23:24.857Z"}},"headers":{"unique":"testeditanapitestreturnsokresponse1713549974"},"method":"GET","timeout":10,"url":"https://datadoghq.com"}},"message":"BDD - test payload: synthetics_api_test_payload.json","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-TestSyntheticsAPITestLifecycle-1623076664","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"deleted_at":null,"monitor_id":143517848,"org_id":321813,"modified_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"}}' + \"object\", \"properties\":{\"slideshow\":{\"type\":\"object\"}}}","metaSchema":"draft-07"},"type":"body"}],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"certificate":{"key":{"filename":"key-filename","updatedAt":"2020-10-16T09:23:24.857Z"},"cert":{"filename":"cert-filename","updatedAt":"2020-10-16T09:23:24.857Z"}},"headers":{"unique":"testeditanapitestreturnsokresponse1717780270"},"method":"GET","timeout":10,"url":"https://datadoghq.com"}},"message":"BDD + test payload: synthetics_api_test_payload.json","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-TestSyntheticsAPITestLifecycle-1623076664","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"},"deleted_at":null,"monitor_id":146628226,"org_id":321813,"modified_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"}}' code: 200 duration: 0ms headers: @@ -47,7 +51,7 @@ interactions: status: 200 OK - request: body: | - {"public_ids":["xrn-jgn-wrk"]} + {"public_ids":["e95-8kp-s23"]} form: {} headers: Accept: @@ -58,7 +62,7 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/delete response: - body: '{"deleted_tests":[{"public_id":"xrn-jgn-wrk","deleted_at":"2024-04-19T18:06:16.249117+00:00"}]} + body: '{"deleted_tests":[{"public_id":"e95-8kp-s23","deleted_at":"2024-06-07T17:11:12.756956+00:00"}]} ' code: 200 diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Patch_a_Synthetic_test_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Patch_a_Synthetic_test_returns_OK_response.freeze index 21bb6d73beb..151fdd692d6 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Patch_a_Synthetic_test_returns_OK_response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Patch_a_Synthetic_test_returns_OK_response.freeze @@ -1 +1 @@ -2024-04-19T18:06:17.111Z \ No newline at end of file +2024-06-07T17:11:12.906Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Patch_a_Synthetic_test_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Patch_a_Synthetic_test_returns_OK_response.yaml index eb6378307c5..d17e236883f 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Patch_a_Synthetic_test_returns_OK_response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Patch_a_Synthetic_test_returns_OK_response.yaml @@ -1,7 +1,7 @@ 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":"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"}],"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":"testpatchasynthetictestreturnsokresponse1713549977"},"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-Patch_a_Synthetic_test_returns_OK_response-1713549977","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Patch_a_Synthetic_test_returns_OK_response-1713549977","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} + {"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":"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"}],"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":"testpatchasynthetictestreturnsokresponse1717780272"},"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-Patch_a_Synthetic_test_returns_OK_response-1717780272","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Patch_a_Synthetic_test_returns_OK_response-1717780272","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} form: {} headers: Accept: @@ -12,10 +12,12 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/api response: - body: '{"public_id":"csc-m3c-65b","name":"Test-Patch_a_Synthetic_test_returns_OK_response-1713549977","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-04-19T18:06:17.422271+00:00","modified_at":"2024-04-19T18:06:17.422271+00:00","config":{"assertions":[{"operator":"is","property":"{{ + body: '{"public_id":"zba-98n-3nj","name":"Test-Patch_a_Synthetic_test_returns_OK_response-1717780272","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-06-07T17:11:13.267998+00:00","modified_at":"2024-06-07T17:11:13.267998+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":"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"}],"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":"testpatchasynthetictestreturnsokresponse1713549977"},"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-Patch_a_Synthetic_test_returns_OK_response-1713549977","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"deleted_at":null,"monitor_id":143517849,"org_id":321813,"modified_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"}}' + \"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"}],"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":"testpatchasynthetictestreturnsokresponse1717780272"},"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-Patch_a_Synthetic_test_returns_OK_response-1717780272","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"},"deleted_at":null,"monitor_id":146628227,"org_id":321813,"modified_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"}}' code: 200 duration: 0ms headers: @@ -33,11 +35,13 @@ interactions: - application/json id: 1 method: PATCH - url: https://api.datadoghq.com/api/v1/synthetics/tests/csc-m3c-65b + url: https://api.datadoghq.com/api/v1/synthetics/tests/zba-98n-3nj response: - body: '{"public_id":"csc-m3c-65b","name":"New test name","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-04-19T18:06:17.422271+00:00","modified_at":"2024-04-19T18:06:17.857232+00:00","config":{"assertions":[{"operator":"lessThan","target":2000,"timingsScope":"withoutDNS","type":"responseTime"},{"operator":"validatesJSONPath","target":{"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"}],"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":{"key":{"filename":"key-filename","updatedAt":"2020-10-16T09:23:24.857Z"},"cert":{"filename":"cert-filename","updatedAt":"2020-10-16T09:23:24.857Z"}},"headers":{"unique":"testpatchasynthetictestreturnsokresponse1713549977"},"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-Patch_a_Synthetic_test_returns_OK_response-1713549977","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"deleted_at":null,"monitor_id":143517849,"org_id":321813,"modified_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"}}' + body: '{"public_id":"zba-98n-3nj","name":"New test name","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-06-07T17:11:13.267998+00:00","modified_at":"2024-06-07T17:11:13.657947+00:00","config":{"assertions":[{"operator":"lessThan","target":2000,"timingsScope":"withoutDNS","type":"responseTime"},{"operator":"validatesJSONPath","target":{"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"}],"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":{"key":{"filename":"key-filename","updatedAt":"2020-10-16T09:23:24.857Z"},"cert":{"filename":"cert-filename","updatedAt":"2020-10-16T09:23:24.857Z"}},"headers":{"unique":"testpatchasynthetictestreturnsokresponse1717780272"},"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-Patch_a_Synthetic_test_returns_OK_response-1717780272","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"},"deleted_at":null,"monitor_id":146628227,"org_id":321813,"modified_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"}}' code: 200 duration: 0ms headers: @@ -46,7 +50,7 @@ interactions: status: 200 OK - request: body: | - {"public_ids":["csc-m3c-65b"]} + {"public_ids":["zba-98n-3nj"]} form: {} headers: Accept: @@ -57,7 +61,7 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/delete response: - body: '{"deleted_tests":[{"public_id":"csc-m3c-65b","deleted_at":"2024-04-19T18:06:18.506843+00:00"}]} + body: '{"deleted_tests":[{"public_id":"zba-98n-3nj","deleted_at":"2024-06-07T17:11:14.334270+00:00"}]} ' code: 200 diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Trigger_Synthetic_tests_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Trigger_Synthetic_tests_returns_OK_response.freeze index ccc6f17e7a0..cfa99958f0d 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Trigger_Synthetic_tests_returns_OK_response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Trigger_Synthetic_tests_returns_OK_response.freeze @@ -1 +1 @@ -2024-04-19T18:06:18.874Z \ No newline at end of file +2024-06-07T17:11:14.533Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Trigger_Synthetic_tests_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Trigger_Synthetic_tests_returns_OK_response.yaml index ca3bb4e092d..6f7c7437aaa 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Trigger_Synthetic_tests_returns_OK_response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Synthetics/Scenario_Trigger_Synthetic_tests_returns_OK_response.yaml @@ -1,7 +1,7 @@ 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":"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"}],"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":"testtriggersynthetictestsreturnsokresponse1713549978"},"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-Trigger_Synthetic_tests_returns_OK_response-1713549978","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Trigger_Synthetic_tests_returns_OK_response-1713549978","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} + {"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":"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"}],"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":"testtriggersynthetictestsreturnsokresponse1717780274"},"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-Trigger_Synthetic_tests_returns_OK_response-1717780274","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Trigger_Synthetic_tests_returns_OK_response-1717780274","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"} form: {} headers: Accept: @@ -12,10 +12,12 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/api response: - body: '{"public_id":"4kz-wi9-3gu","name":"Test-Trigger_Synthetic_tests_returns_OK_response-1713549978","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-04-19T18:06:19.222224+00:00","modified_at":"2024-04-19T18:06:19.222224+00:00","config":{"assertions":[{"operator":"is","property":"{{ + body: '{"public_id":"fbg-cs6-aq7","name":"Test-Trigger_Synthetic_tests_returns_OK_response-1717780274","status":"live","type":"api","tags":["testing:api"],"created_at":"2024-06-07T17:11:14.930630+00:00","modified_at":"2024-06-07T17:11:14.930630+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":"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"}],"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":"testtriggersynthetictestsreturnsokresponse1713549978"},"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-Trigger_Synthetic_tests_returns_OK_response-1713549978","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"deleted_at":null,"monitor_id":143517850,"org_id":321813,"modified_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"}}' + \"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"}],"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":"testtriggersynthetictestsreturnsokresponse1717780274"},"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-Trigger_Synthetic_tests_returns_OK_response-1717780274","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"},"deleted_at":null,"monitor_id":146628228,"org_id":321813,"modified_by":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"}}' code: 200 duration: 0ms headers: @@ -24,7 +26,7 @@ interactions: status: 200 OK - request: body: | - {"tests":[{"public_id":"4kz-wi9-3gu"}]} + {"tests":[{"public_id":"fbg-cs6-aq7"}]} form: {} headers: Accept: @@ -35,7 +37,7 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/trigger response: - body: '{"triggered_check_ids":["4kz-wi9-3gu"],"results":[{"public_id":"4kz-wi9-3gu","location":30005,"result_id":"4058014420339337998"}],"locations":[{"id":30005,"name":"aws:us-east-2","display_name":"Ohio + body: '{"triggered_check_ids":["fbg-cs6-aq7"],"results":[{"public_id":"fbg-cs6-aq7","location":30005,"result_id":"2808787540874411699"}],"locations":[{"id":30005,"name":"aws:us-east-2","display_name":"Ohio (AWS)","region":"Americas","is_active":true,"is_public":true,"metadata":null}],"batch_id":null} ' @@ -47,7 +49,7 @@ interactions: status: 200 OK - request: body: | - {"public_ids":["4kz-wi9-3gu"]} + {"public_ids":["fbg-cs6-aq7"]} form: {} headers: Accept: @@ -58,7 +60,7 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/synthetics/tests/delete response: - body: '{"deleted_tests":[{"public_id":"4kz-wi9-3gu","deleted_at":"2024-04-19T18:06:19.909119+00:00"}]} + body: '{"deleted_tests":[{"public_id":"fbg-cs6-aq7","deleted_at":"2024-06-07T17:11:17.222801+00:00"}]} ' code: 200 diff --git a/tests/scenarios/features/v1/given.json b/tests/scenarios/features/v1/given.json index 8205ca9ee1e..ef843aad2a7 100644 --- a/tests/scenarios/features/v1/given.json +++ b/tests/scenarios/features/v1/given.json @@ -238,7 +238,7 @@ "parameters": [ { "name": "body", - "value": "{\n \"config\": {\n \"assertions\": [\n {\n \"operator\": \"is\",\n \"property\": \"{{ '{{ PROPERTY }}' }}\",\n \"target\": \"text/html\",\n \"type\": \"header\"\n },\n { \"operator\": \"lessThan\", \"target\": 2000, \"type\": \"responseTime\", \"timingsScope\": \"withoutDNS\" },\n {\n \"operator\": \"validatesJSONPath\",\n \"target\": {\n \"jsonPath\": \"topKey\",\n \"operator\": \"isNot\",\n \"targetValue\": \"0\"\n },\n \"type\": \"body\"\n },\n {\n \"operator\": \"validatesJSONSchema\",\n \"target\": {\n \"metaSchema\": \"draft-07\",\n \"jsonSchema\": \"{\\\"type\\\": \\\"object\\\", \\\"properties\\\":{\\\"slideshow\\\":{\\\"type\\\":\\\"object\\\"}}}\"\n },\n \"type\": \"body\"\n },\n {\n \"operator\": \"validatesXPath\",\n \"target\": {\n \"xPath\": \"target-xpath\",\n \"targetValue\": \"0\",\n \"operator\": \"contains\"\n },\n \"type\": \"body\"\n }\n ],\n \"configVariables\": [\n {\n \"example\": \"content-type\",\n \"name\": \"PROPERTY\",\n \"pattern\": \"content-type\",\n \"type\": \"text\"\n }\n ],\n \"variablesFromScript\": \"dd.variable.set(\\\"FOO\\\", \\\"foo\\\")\",\n \"request\": {\n \"certificate\": {\n \"cert\": {\n \"content\": \"cert-content\",\n \"filename\": \"cert-filename\",\n \"updatedAt\": \"2020-10-16T09:23:24.857Z\"\n },\n \"key\": {\n \"content\": \"key-content\",\n \"filename\": \"key-filename\",\n \"updatedAt\": \"2020-10-16T09:23:24.857Z\"\n }\n },\n \"headers\": { \"unique\": \"{{ unique_lower_alnum }}\" },\n \"method\": \"GET\",\n \"timeout\": 10,\n \"url\": \"https://datadoghq.com\",\n \"proxy\": {\n \"url\": \"https://datadoghq.com\",\n \"headers\": {}\n },\n \"basicAuth\": {\n \"accessTokenUrl\": \"https://datadog-token.com\",\n \"audience\": \"audience\",\n \"clientId\": \"client-id\",\n \"clientSecret\": \"client-secret\",\n \"resource\": \"resource\",\n \"scope\": \"yoyo\",\n \"tokenApiAuthentication\": \"header\",\n \"type\": \"oauth-client\"\n },\n \"persistCookies\": true\n }\n },\n \"locations\": [\"aws:us-east-2\"],\n \"message\": \"BDD test payload: synthetics_api_http_test_payload.json\",\n \"name\": \"{{ unique }}\",\n \"options\": {\n \"accept_self_signed\": false,\n \"allow_insecure\": true,\n \"follow_redirects\": true,\n \"min_failure_duration\": 10,\n \"min_location_failed\": 1,\n \"monitor_name\": \"{{ unique }}\",\n \"monitor_priority\": 5,\n \"retry\": { \"count\": 3, \"interval\": 10 },\n \"tick_every\": 60,\n \"httpVersion\": \"http2\"\n },\n \"subtype\": \"http\",\n \"tags\": [\"testing:api\"],\n \"type\": \"api\"\n}\n" + "value": "{\n \"config\": {\n \"assertions\": [\n {\n \"operator\": \"is\",\n \"property\": \"{{ '{{ PROPERTY }}' }}\",\n \"target\": \"text/html\",\n \"type\": \"header\"\n },\n { \"operator\": \"lessThan\", \"target\": 2000, \"type\": \"responseTime\", \"timingsScope\": \"withoutDNS\" },\n {\n \"operator\": \"validatesJSONPath\",\n \"target\": {\n \"jsonPath\": \"topKey\",\n \"operator\": \"isNot\",\n \"targetValue\": \"0\"\n },\n \"type\": \"body\"\n },\n {\n \"operator\": \"validatesJSONSchema\",\n \"target\": {\n \"metaSchema\": \"draft-07\",\n \"jsonSchema\": \"{\\\"type\\\": \\\"object\\\", \\\"properties\\\":{\\\"slideshow\\\":{\\\"type\\\":\\\"object\\\"}}}\"\n },\n \"type\": \"body\"\n },\n {\n \"operator\": \"validatesXPath\",\n \"target\": {\n \"xPath\": \"target-xpath\",\n \"targetValue\": \"0\",\n \"operator\": \"contains\"\n },\n \"type\": \"body\"\n },\n {\n \"operator\": \"md5\",\n \"target\": \"a\",\n \"type\": \"bodyHash\"\n }\n ],\n \"configVariables\": [\n {\n \"example\": \"content-type\",\n \"name\": \"PROPERTY\",\n \"pattern\": \"content-type\",\n \"type\": \"text\"\n }\n ],\n \"variablesFromScript\": \"dd.variable.set(\\\"FOO\\\", \\\"foo\\\")\",\n \"request\": {\n \"certificate\": {\n \"cert\": {\n \"content\": \"cert-content\",\n \"filename\": \"cert-filename\",\n \"updatedAt\": \"2020-10-16T09:23:24.857Z\"\n },\n \"key\": {\n \"content\": \"key-content\",\n \"filename\": \"key-filename\",\n \"updatedAt\": \"2020-10-16T09:23:24.857Z\"\n }\n },\n \"headers\": { \"unique\": \"{{ unique_lower_alnum }}\" },\n \"method\": \"GET\",\n \"timeout\": 10,\n \"url\": \"https://datadoghq.com\",\n \"proxy\": {\n \"url\": \"https://datadoghq.com\",\n \"headers\": {}\n },\n \"basicAuth\": {\n \"accessTokenUrl\": \"https://datadog-token.com\",\n \"audience\": \"audience\",\n \"clientId\": \"client-id\",\n \"clientSecret\": \"client-secret\",\n \"resource\": \"resource\",\n \"scope\": \"yoyo\",\n \"tokenApiAuthentication\": \"header\",\n \"type\": \"oauth-client\"\n },\n \"persistCookies\": true\n }\n },\n \"locations\": [\"aws:us-east-2\"],\n \"message\": \"BDD test payload: synthetics_api_http_test_payload.json\",\n \"name\": \"{{ unique }}\",\n \"options\": {\n \"accept_self_signed\": false,\n \"allow_insecure\": true,\n \"follow_redirects\": true,\n \"min_failure_duration\": 10,\n \"min_location_failed\": 1,\n \"monitor_name\": \"{{ unique }}\",\n \"monitor_priority\": 5,\n \"retry\": { \"count\": 3, \"interval\": 10 },\n \"tick_every\": 60,\n \"httpVersion\": \"http2\"\n },\n \"subtype\": \"http\",\n \"tags\": [\"testing:api\"],\n \"type\": \"api\"\n}\n" } ], "step": "there is a valid \"synthetics_api_test\" in the system", diff --git a/tests/scenarios/features/v1/synthetics.feature b/tests/scenarios/features/v1/synthetics.feature index 07bd1a5147b..91a2abe7eeb 100644 --- a/tests/scenarios/features/v1/synthetics.feature +++ b/tests/scenarios/features/v1/synthetics.feature @@ -132,6 +132,16 @@ Feature: Synthetics Then the response status is 200 OK - Returns the created test details. And the response "name" is equal to "{{ unique }}" + @team:DataDog/synthetics-app + Scenario: Create an API HTTP test has bodyHash filled out + Given new "CreateSyntheticsAPITest" request + And body from file "synthetics_api_http_test_payload.json" + When the request is sent + Then the response status is 200 OK - Returns the created test details. + And the response "config.assertions[5].operator" is equal to "md5" + And the response "config.assertions[5].target" is equal to "a" + And the response "config.assertions[5].type" is equal to "bodyHash" + @team:DataDog/synthetics-app Scenario: Create an API HTTP test returns "OK - Returns the created test details." response Given new "CreateSyntheticsAPITest" request diff --git a/tests/scenarios/features/v1/synthetics_api_http_test_payload.json b/tests/scenarios/features/v1/synthetics_api_http_test_payload.json index e7ec61df3b1..7248594a609 100644 --- a/tests/scenarios/features/v1/synthetics_api_http_test_payload.json +++ b/tests/scenarios/features/v1/synthetics_api_http_test_payload.json @@ -33,6 +33,11 @@ "operator": "contains" }, "type": "body" + }, + { + "operator": "md5", + "target": "a", + "type": "bodyHash" } ], "configVariables": [