Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add synthetics browser step public_id field #2709

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-12-19 07:26:27.191303",
"spec_repo_commit": "5dd2cbe4"
"regenerated": "2024-12-23 17:20:35.684562",
"spec_repo_commit": "19946d35"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-12-19 07:26:27.207255",
"spec_repo_commit": "5dd2cbe4"
"regenerated": "2024-12-23 17:20:35.701251",
"spec_repo_commit": "19946d35"
}
}
}
3 changes: 3 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16274,6 +16274,9 @@ components:
params:
description: The parameters of the step.
type: object
public_id:
description: The public ID of the step.
type: string
timeout:
description: The time before declaring a step failed.
format: int64
Expand Down
37 changes: 36 additions & 1 deletion api/datadogV1/model_synthetics_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type SyntheticsStep struct {
NoScreenshot *bool `json:"noScreenshot,omitempty"`
// The parameters of the step.
Params interface{} `json:"params,omitempty"`
// The public ID of the step.
PublicId *string `json:"public_id,omitempty"`
// The time before declaring a step failed.
Timeout *int64 `json:"timeout,omitempty"`
// Step type used in your Synthetic test.
Expand Down Expand Up @@ -246,6 +248,34 @@ func (o *SyntheticsStep) SetParams(v interface{}) {
o.Params = v
}

// GetPublicId returns the PublicId field value if set, zero value otherwise.
func (o *SyntheticsStep) GetPublicId() string {
if o == nil || o.PublicId == nil {
var ret string
return ret
}
return *o.PublicId
}

// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsStep) GetPublicIdOk() (*string, bool) {
if o == nil || o.PublicId == nil {
return nil, false
}
return o.PublicId, true
}

// HasPublicId returns a boolean if a field has been set.
func (o *SyntheticsStep) HasPublicId() bool {
return o != nil && o.PublicId != nil
}

// SetPublicId gets a reference to the given string and assigns it to the PublicId field.
func (o *SyntheticsStep) SetPublicId(v string) {
o.PublicId = &v
}

// GetTimeout returns the Timeout field value if set, zero value otherwise.
func (o *SyntheticsStep) GetTimeout() int64 {
if o == nil || o.Timeout == nil {
Expand Down Expand Up @@ -329,6 +359,9 @@ func (o SyntheticsStep) MarshalJSON() ([]byte, error) {
if o.Params != nil {
toSerialize["params"] = o.Params
}
if o.PublicId != nil {
toSerialize["public_id"] = o.PublicId
}
if o.Timeout != nil {
toSerialize["timeout"] = o.Timeout
}
Expand All @@ -352,6 +385,7 @@ func (o *SyntheticsStep) UnmarshalJSON(bytes []byte) (err error) {
Name *string `json:"name,omitempty"`
NoScreenshot *bool `json:"noScreenshot,omitempty"`
Params interface{} `json:"params,omitempty"`
PublicId *string `json:"public_id,omitempty"`
Timeout *int64 `json:"timeout,omitempty"`
Type *SyntheticsStepType `json:"type,omitempty"`
}{}
Expand All @@ -360,7 +394,7 @@ func (o *SyntheticsStep) UnmarshalJSON(bytes []byte) (err error) {
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"allowFailure", "alwaysExecute", "exitIfSucceed", "isCritical", "name", "noScreenshot", "params", "timeout", "type"})
datadog.DeleteKeys(additionalProperties, &[]string{"allowFailure", "alwaysExecute", "exitIfSucceed", "isCritical", "name", "noScreenshot", "params", "public_id", "timeout", "type"})
} else {
return err
}
Expand All @@ -373,6 +407,7 @@ func (o *SyntheticsStep) UnmarshalJSON(bytes []byte) (err error) {
o.Name = all.Name
o.NoScreenshot = all.NoScreenshot
o.Params = all.Params
o.PublicId = all.PublicId
o.Timeout = all.Timeout
if all.Type != nil && !all.Type.IsValid() {
hasInvalidField = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-09T11:17:43.729Z
2024-12-23T09:47:16.115Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"config":{"assertions":[],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"certificateDomains":["https://datadoghq.com"],"method":"GET","url":"https://datadoghq.com"},"setCookie":"name:test"},"locations":["aws:us-east-2"],"message":"Test message","name":"Test-Create_a_browser_test_returns_OK_Returns_saved_rumSettings_response-1733743063","options":{"accept_self_signed":false,"allow_insecure":true,"ci":{"executionRule":"skipped"},"device_ids":["tablet"],"disableCors":true,"disableCsp":true,"follow_redirects":true,"ignoreServerCertificateError":true,"initialNavigationTimeout":200,"min_failure_duration":10,"min_location_failed":1,"noScreenshot":true,"retry":{"count":2,"interval":10},"rumSettings":{"applicationId":"mockApplicationId","clientTokenId":12345,"isEnabled":true},"tick_every":300},"steps":[{"allowFailure":false,"isCritical":true,"name":"Refresh page","params":{},"type":"refresh"}],"tags":["testing:browser"],"type":"browser"}
{"config":{"assertions":[],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"certificateDomains":["https://datadoghq.com"],"method":"GET","url":"https://datadoghq.com"},"setCookie":"name:test"},"locations":["aws:us-east-2"],"message":"Test message","name":"Test-Create_a_browser_test_returns_OK_Returns_saved_rumSettings_response-1734947236","options":{"accept_self_signed":false,"allow_insecure":true,"ci":{"executionRule":"skipped"},"device_ids":["tablet"],"disableCors":true,"disableCsp":true,"follow_redirects":true,"ignoreServerCertificateError":true,"initialNavigationTimeout":200,"min_failure_duration":10,"min_location_failed":1,"noScreenshot":true,"retry":{"count":2,"interval":10},"rumSettings":{"applicationId":"mockApplicationId","clientTokenId":12345,"isEnabled":true},"tick_every":300},"steps":[{"allowFailure":false,"isCritical":true,"name":"Refresh page","params":{},"type":"refresh"}],"tags":["testing:browser"],"type":"browser"}
form: {}
headers:
Accept:
Expand All @@ -12,9 +12,9 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v1/synthetics/tests/browser
response:
body: '{"public_id":"jj5-nke-dq2","name":"Test-Create_a_browser_test_returns_OK_Returns_saved_rumSettings_response-1733743063","status":"paused","type":"browser","tags":["testing:browser"],"created_at":"2024-12-09T11:17:44.348239+00:00","modified_at":"2024-12-09T11:17:44.348239+00:00","config":{"assertions":[],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"certificateDomains":["https://datadoghq.com"],"method":"GET","url":"https://datadoghq.com"},"setCookie":"name:test"},"message":"Test
message","options":{"accept_self_signed":false,"allow_insecure":true,"ci":{"executionRule":"skipped"},"device_ids":["tablet"],"disableCors":true,"disableCsp":true,"follow_redirects":true,"ignoreServerCertificateError":true,"initialNavigationTimeout":200,"min_failure_duration":10,"min_location_failed":1,"noScreenshot":true,"retry":{"count":2,"interval":10},"rumSettings":{"applicationId":"mockApplicationId","clientTokenId":12345,"isEnabled":true},"tick_every":300},"locations":["aws:us-east-2"],"created_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"deleted_at":null,"monitor_id":159881000,"org_id":321813,"modified_by":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"steps":[{"name":"Refresh
page","params":{},"type":"refresh","public_id":"yb6-rim-kwp","allowFailure":false,"isCritical":true}],"stepCount":{"assertions":0,"subtests":0,"total":1}}'
body: '{"public_id":"2pq-h6b-phj","name":"Test-Create_a_browser_test_returns_OK_Returns_saved_rumSettings_response-1734947236","status":"paused","type":"browser","tags":["testing:browser"],"created_at":"2024-12-23T09:47:16.924773+00:00","modified_at":"2024-12-23T09:47:16.924773+00:00","config":{"assertions":[],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"certificateDomains":["https://datadoghq.com"],"method":"GET","url":"https://datadoghq.com"},"setCookie":"name:test"},"message":"Test
message","options":{"accept_self_signed":false,"allow_insecure":true,"ci":{"executionRule":"skipped"},"device_ids":["tablet"],"disableCors":true,"disableCsp":true,"follow_redirects":true,"ignoreServerCertificateError":true,"initialNavigationTimeout":200,"min_failure_duration":10,"min_location_failed":1,"noScreenshot":true,"retry":{"count":2,"interval":10},"rumSettings":{"applicationId":"mockApplicationId","clientTokenId":12345,"isEnabled":true},"tick_every":300},"locations":["aws:us-east-2"],"created_by":{"name":"frog","handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"deleted_at":null,"monitor_id":161011666,"org_id":321813,"modified_by":{"name":"frog","handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"steps":[{"name":"Refresh
page","params":{},"type":"refresh","public_id":"uwt-8ia-g4p","allowFailure":false,"isCritical":true}],"stepCount":{"assertions":0,"subtests":0,"total":1}}'
code: 200
duration: 0ms
headers:
Expand All @@ -23,7 +23,7 @@ interactions:
status: 200 OK
- request:
body: |
{"public_ids":["jj5-nke-dq2"]}
{"public_ids":["2pq-h6b-phj"]}
form: {}
headers:
Accept:
Expand All @@ -34,7 +34,7 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v1/synthetics/tests/delete
response:
body: '{"deleted_tests":[{"public_id":"jj5-nke-dq2","deleted_at":"2024-12-09T11:17:45.340410+00:00"}]}
body: '{"deleted_tests":[{"public_id":"2pq-h6b-phj","deleted_at":"2024-12-23T09:47:17.898440+00:00"}]}

'
code: 200
Expand Down
1 change: 1 addition & 0 deletions tests/scenarios/features/v1/synthetics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Feature: Synthetics
And the response "options.rumSettings.isEnabled" is equal to true
And the response "options.rumSettings.applicationId" is equal to "mockApplicationId"
And the response "options.rumSettings.clientTokenId" is equal to 12345
And the response "steps[0]" has field "public_id"

@team:DataDog/synthetics-ct
Scenario: Create a browser test returns "OK - Returns the created test details." response
Expand Down
Loading