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 trigger synthetics tests endpoint #546

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.5.1.dev2",
"regenerated": "2021-11-12 17:10:44.410323",
"spec_repo_commit": "a5c075c"
"regenerated": "2021-11-12 17:41:08.923195",
"spec_repo_commit": "2b850b7"
},
"v2": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2021-11-12 17:10:44.442753",
"spec_repo_commit": "a5c075c"
"regenerated": "2021-11-12 17:41:08.956954",
"spec_repo_commit": "2b850b7"
}
}
}
53 changes: 53 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11075,6 +11075,17 @@ components:
format: double
type: number
type: object
SyntheticsTriggerBody:
description: Object describing the synthetics tests to trigger.
properties:
tests:
description: Individual synthetics test.
items:
$ref: '#/components/schemas/SyntheticsTriggerTest'
type: array
required:
- tests
type: object
SyntheticsTriggerCITestLocation:
description: Synthetics location.
properties:
Expand Down Expand Up @@ -11125,6 +11136,18 @@ components:
type: string
type: array
type: object
SyntheticsTriggerTest:
description: Test configuration for Synthetics
properties:
metadata:
$ref: '#/components/schemas/SyntheticsCIBatchMetadata'
public_id:
description: The public ID of the Synthetics test to trigger.
example: aaa-aaa-aaa
type: string
required:
- public_id
type: object
SyntheticsUpdateTestPauseStatusPayload:
description: Object to start or pause an existing Synthetic test.
properties:
Expand Down Expand Up @@ -22683,6 +22706,36 @@ paths:
x-menu-order: 14
x-undo:
type: idempotent
/api/v1/synthetics/tests/trigger:
post:
description: Trigger a set of Synthetics tests.
operationId: TriggerTests
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SyntheticsTriggerBody'
description: The identifiers of the tests to trigger.
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/SyntheticsTriggerCITestsResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
summary: Trigger some Synthetics tests
tags:
- Synthetics
x-codegen-request-body-name: body
x-undo:
type: safe
/api/v1/synthetics/tests/trigger/ci:
post:
description: Trigger a set of Synthetics tests for continuous integration.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ All URIs are relative to *https://api.datadoghq.com*
| _DatadogAPIClient::V1::SyntheticsAPI_ | [**list_locations**](SyntheticsAPI.md#list_locations) | **GET** /api/v1/synthetics/locations | Get all locations (public and private) |
| _DatadogAPIClient::V1::SyntheticsAPI_ | [**list_tests**](SyntheticsAPI.md#list_tests) | **GET** /api/v1/synthetics/tests | Get the list of all tests |
| _DatadogAPIClient::V1::SyntheticsAPI_ | [**trigger_ci_tests**](SyntheticsAPI.md#trigger_ci_tests) | **POST** /api/v1/synthetics/tests/trigger/ci | Trigger tests from CI/CD pipelines |
| _DatadogAPIClient::V1::SyntheticsAPI_ | [**trigger_tests**](SyntheticsAPI.md#trigger_tests) | **POST** /api/v1/synthetics/tests/trigger | Trigger some Synthetics tests |
| _DatadogAPIClient::V1::SyntheticsAPI_ | [**update_api_test**](SyntheticsAPI.md#update_api_test) | **PUT** /api/v1/synthetics/tests/api/{public_id} | Edit an API test |
| _DatadogAPIClient::V1::SyntheticsAPI_ | [**update_browser_test**](SyntheticsAPI.md#update_browser_test) | **PUT** /api/v1/synthetics/tests/browser/{public_id} | Edit a browser test |
| _DatadogAPIClient::V1::SyntheticsAPI_ | [**update_private_location**](SyntheticsAPI.md#update_private_location) | **PUT** /api/v1/synthetics/private-locations/{location_id} | Edit a private location |
Expand Down Expand Up @@ -711,9 +712,11 @@ All URIs are relative to *https://api.datadoghq.com*
- [DatadogAPIClient::V1::SyntheticsTestRequestCertificate](SyntheticsTestRequestCertificate.md)
- [DatadogAPIClient::V1::SyntheticsTestRequestCertificateItem](SyntheticsTestRequestCertificateItem.md)
- [DatadogAPIClient::V1::SyntheticsTiming](SyntheticsTiming.md)
- [DatadogAPIClient::V1::SyntheticsTriggerBody](SyntheticsTriggerBody.md)
- [DatadogAPIClient::V1::SyntheticsTriggerCITestLocation](SyntheticsTriggerCITestLocation.md)
- [DatadogAPIClient::V1::SyntheticsTriggerCITestRunResult](SyntheticsTriggerCITestRunResult.md)
- [DatadogAPIClient::V1::SyntheticsTriggerCITestsResponse](SyntheticsTriggerCITestsResponse.md)
- [DatadogAPIClient::V1::SyntheticsTriggerTest](SyntheticsTriggerTest.md)
- [DatadogAPIClient::V1::SyntheticsUpdateTestPauseStatusPayload](SyntheticsUpdateTestPauseStatusPayload.md)
- [DatadogAPIClient::V1::SyntheticsVariableParser](SyntheticsVariableParser.md)
- [DatadogAPIClient::V1::SyntheticsWarningType](SyntheticsWarningType.md)
Expand Down
60 changes: 60 additions & 0 deletions docs/v1/SyntheticsAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ All URIs are relative to *https://api.datadoghq.com*
| [**list_locations**](SyntheticsAPI.md#list_locations) | **GET** /api/v1/synthetics/locations | Get all locations (public and private) |
| [**list_tests**](SyntheticsAPI.md#list_tests) | **GET** /api/v1/synthetics/tests | Get the list of all tests |
| [**trigger_ci_tests**](SyntheticsAPI.md#trigger_ci_tests) | **POST** /api/v1/synthetics/tests/trigger/ci | Trigger tests from CI/CD pipelines |
| [**trigger_tests**](SyntheticsAPI.md#trigger_tests) | **POST** /api/v1/synthetics/tests/trigger | Trigger some Synthetics tests |
| [**update_api_test**](SyntheticsAPI.md#update_api_test) | **PUT** /api/v1/synthetics/tests/api/{public_id} | Edit an API test |
| [**update_browser_test**](SyntheticsAPI.md#update_browser_test) | **PUT** /api/v1/synthetics/tests/browser/{public_id} | Edit a browser test |
| [**update_private_location**](SyntheticsAPI.md#update_private_location) | **PUT** /api/v1/synthetics/private-locations/{location_id} | Edit a private location |
Expand Down Expand Up @@ -1343,6 +1344,65 @@ end
- **Content-Type**: application/json
- **Accept**: application/json

## trigger_tests

> <SyntheticsTriggerCITestsResponse> trigger_tests(body)

Trigger a set of Synthetics tests.

### Examples

```ruby
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
body = DatadogAPIClient::V1::SyntheticsTriggerBody.new({tests: [DatadogAPIClient::V1::SyntheticsTriggerTest.new({public_id: 'aaa-aaa-aaa'})]}) # SyntheticsTriggerBody | The identifiers of the tests to trigger.

begin
# Trigger some Synthetics tests
result = api_instance.trigger_tests(body)
p result
rescue DatadogAPIClient::V1::APIError => e
puts "Error when calling SyntheticsAPI->trigger_tests: #{e}"
end
```

#### Using the trigger_tests_with_http_info variant

This returns an Array which contains the response data, status code and headers.

> <Array(<SyntheticsTriggerCITestsResponse>, Integer, Hash)> trigger_tests_with_http_info(body)

```ruby
begin
# Trigger some Synthetics tests
data, status_code, headers = api_instance.trigger_tests_with_http_info(body)
p status_code # => 2xx
p headers # => { ... }
p data # => <SyntheticsTriggerCITestsResponse>
rescue DatadogAPIClient::V1::APIError => e
puts "Error when calling SyntheticsAPI->trigger_tests_with_http_info: #{e}"
end
```

### Parameters

| Name | Type | Description | Notes |
| -------- | ----------------------------------------------------- | ---------------------------------------- | ----- |
| **body** | [**SyntheticsTriggerBody**](SyntheticsTriggerBody.md) | The identifiers of the tests to trigger. | |

### Return type

[**SyntheticsTriggerCITestsResponse**](SyntheticsTriggerCITestsResponse.md)

### Authorization

[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

## update_api_test

> <SyntheticsAPITest> update_api_test(public_id, body)
Expand Down
18 changes: 18 additions & 0 deletions docs/v1/SyntheticsTriggerBody.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# DatadogAPIClient::V1::SyntheticsTriggerBody

## Properties

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **tests** | [**Array&lt;SyntheticsTriggerTest&gt;**](SyntheticsTriggerTest.md) | Individual synthetics test. | |

## Example

```ruby
require 'datadog_api_client/v1'

instance = DatadogAPIClient::V1::SyntheticsTriggerBody.new(
tests: null
)
```

20 changes: 20 additions & 0 deletions docs/v1/SyntheticsTriggerTest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# DatadogAPIClient::V1::SyntheticsTriggerTest

## Properties

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **metadata** | [**SyntheticsCIBatchMetadata**](SyntheticsCIBatchMetadata.md) | | [optional] |
| **public_id** | **String** | The public ID of the Synthetics test to trigger. | |

## Example

```ruby
require 'datadog_api_client/v1'

instance = DatadogAPIClient::V1::SyntheticsTriggerTest.new(
metadata: null,
public_id: aaa-aaa-aaa
)
```

14 changes: 14 additions & 0 deletions features/v1/synthetics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,20 @@ Feature: Synthetics
When the request is sent
Then the response status is 200 OK - Returns a boolean indicating if the update was successful.

@generated @skip
Scenario: Trigger some Synthetics tests returns "Bad Request" response
Given new "TriggerTests" request
And body with value {"tests": [{"metadata": {"ci": {"pipeline": {"url": null}, "provider": {"name": null}}, "git": {"branch": null, "commitSha": null}}, "public_id": "aaa-aaa-aaa"}]}
When the request is sent
Then the response status is 400 Bad Request

Scenario: Trigger some Synthetics tests returns "OK" response
Given there is a valid "synthetics_api_test" in the system
And new "TriggerTests" request
And body with value {"tests": [{"public_id": "{{ synthetics_api_test.public_id }}"}]}
When the request is sent
Then the response status is 200 OK

@generated @skip
Scenario: Trigger tests from CI/CD pipelines returns "JSON format is wrong" response
Given new "TriggerCITests" request
Expand Down
Loading