Skip to content
Open
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
11 changes: 11 additions & 0 deletions src/test/java/com/datadog/api/RecorderSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.cucumber.java.BeforeAll;
import io.cucumber.java.Scenario;
import io.cucumber.java.Status;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.When;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -197,6 +198,16 @@ public String getCassetteName() {
return world.getName() + ".json";
}

@Given("the request and response use {string} compression")
public void theRequestAndResponseUseCompression(String compression) {
// The generated replay server validates the request and compresses the recorded response.
}

@Given("the client selects {string} compression")
public void theClientSelectsCompression(String compression) {
// The generated request plan passes the selected compression to the client call.
}

@When("the request is sent")
public void theRequestIsSent() throws Exception {
TestRunner.applyPlan(world, false);
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/datadog/api/TestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ public static void applyPlan(World world, boolean pagination) throws Exception {
Object value = materialize(body.get("value"), world);
world.addMaterializedRequestParameter("body", MAPPER.writeValueAsString(value));
}
if (request.get("selected_compression") != null) {
world.addMaterializedRequestParameter(
"Content-Encoding", MAPPER.writeValueAsString(request.get("selected_compression")));
}
for (Map<String, Object> parameter : parameters) {
if (!"path".equals(parameter.get("in")) && !Boolean.TRUE.equals(parameter.get("required"))) {
applyParameter(world, parameter);
Expand Down
10 changes: 6 additions & 4 deletions src/test/resources/com/datadog/api/client/v1/api/logs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@ Feature: Logs
When the request is sent
Then the response status is 200 OK

@integration-only @skip-terraform-config @skip-validation @team:DataDog/event-platform-intake
@skip-terraform-config @skip-validation @team:DataDog/event-platform-intake
Scenario: Send deflate logs returns "Response from server (always 200 empty JSON)." response
Given new "SubmitLog" request
And body with value [{"message": "{{ unique }}", "ddtags": "host:{{ unique_alnum }}"}]
And request contains "Content-Encoding" parameter with value "deflate"
And the client selects "deflate" compression
And the request and response use "deflate" compression
When the request is sent
Then the response status is 200 Response from server (always 200 empty JSON).

@integration-only @skip-terraform-config @skip-validation @team:DataDog/event-platform-intake
@skip-terraform-config @skip-validation @team:DataDog/event-platform-intake
Scenario: Send gzip logs returns "Response from server (always 200 empty JSON)." response
Given new "SubmitLog" request
And body with value [{"message": "{{ unique }}", "ddtags": "host:{{ unique_alnum }}"}]
And request contains "Content-Encoding" parameter with value "gzip"
And the client selects "gzip" compression
And the request and response use "gzip" compression
When the request is sent
Then the response status is 200 Response from server (always 200 empty JSON).

Expand Down
10 changes: 6 additions & 4 deletions src/test/resources/com/datadog/api/client/v2/api/logs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,21 @@ Feature: Logs
Then the response status is 200 OK
And the response has 3 items

@integration-only @skip-terraform-config @skip-validation @team:DataDog/event-platform-intake @team:DataDog/logs-backend @team:DataDog/logs-ingestion
@skip-terraform-config @skip-validation @team:DataDog/event-platform-intake @team:DataDog/logs-backend @team:DataDog/logs-ingestion
Scenario: Send deflate logs returns "Request accepted for processing (always 202 empty JSON)." response
Given new "SubmitLog" request
And body with value [{"ddsource": "nginx", "ddtags": "env:staging,version:5.1", "hostname": "i-012345678", "message": "2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World", "service": "payment"}]
And request contains "Content-Encoding" parameter with value "deflate"
And the client selects "deflate" compression
And the request and response use "deflate" compression
When the request is sent
Then the response status is 202 Response from server (always 202 empty JSON).

@integration-only @skip-terraform-config @skip-validation @team:DataDog/event-platform-intake @team:DataDog/logs-backend @team:DataDog/logs-ingestion
@skip-terraform-config @skip-validation @team:DataDog/event-platform-intake @team:DataDog/logs-backend @team:DataDog/logs-ingestion
Scenario: Send gzip logs returns "Request accepted for processing (always 202 empty JSON)." response
Given new "SubmitLog" request
And body with value [{"ddsource": "nginx", "ddtags": "env:staging,version:5.1", "hostname": "i-012345678", "message": "2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World", "service": "payment"}]
And request contains "Content-Encoding" parameter with value "gzip"
And the client selects "gzip" compression
And the request and response use "gzip" compression
When the request is sent
Then the response status is 202 Request accepted for processing (always 202 empty JSON).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,20 @@
"scenario": "Search test logs returns \"OK\" response",
"version": "v1"
},
{
"feature": "Logs",
"feature_file": "../../com/datadog/api/client/v1/api/logs.feature",
"file": "v1/logs/send-deflate-logs-returns-response-from-server-always-200-empty-json-response.json",
"scenario": "Send deflate logs returns \"Response from server (always 200 empty JSON).\" response",
"version": "v1"
},
{
"feature": "Logs",
"feature_file": "../../com/datadog/api/client/v1/api/logs.feature",
"file": "v1/logs/send-gzip-logs-returns-response-from-server-always-200-empty-json-response.json",
"scenario": "Send gzip logs returns \"Response from server (always 200 empty JSON).\" response",
"version": "v1"
},
{
"feature": "Logs",
"feature_file": "../../com/datadog/api/client/v1/api/logs.feature",
Expand Down Expand Up @@ -6391,6 +6405,20 @@
"scenario": "Search logs returns \"OK\" response with pagination",
"version": "v2"
},
{
"feature": "Logs",
"feature_file": "../../com/datadog/api/client/v2/api/logs.feature",
"file": "v2/logs/send-deflate-logs-returns-request-accepted-for-processing-always-202-empty-json-response.json",
"scenario": "Send deflate logs returns \"Request accepted for processing (always 202 empty JSON).\" response",
"version": "v2"
},
{
"feature": "Logs",
"feature_file": "../../com/datadog/api/client/v2/api/logs.feature",
"file": "v2/logs/send-gzip-logs-returns-request-accepted-for-processing-always-202-empty-json-response.json",
"scenario": "Send gzip logs returns \"Request accepted for processing (always 202 empty JSON).\" response",
"version": "v2"
},
{
"feature": "Logs",
"feature_file": "../../com/datadog/api/client/v2/api/logs.feature",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"api": "Logs",
"expected_status": 200,
"feature": "Logs",
"id": "v1/Logs/Send deflate logs returns \"Response from server (always 200 empty JSON).\" response",
"operation_id": "SubmitLog",
"request": {
"body": {
"schema": {
"format": null,
"items": {
"format": null,
"ref": "HTTPLogItem",
"type": "object"
},
"ref": "HTTPLog",
"type": "array"
},
"source": "inline",
"value": [
{
"ddtags": "host:{{ unique_alnum }}",
"message": "{{ unique }}"
}
]
},
"compression": "deflate",
"content_type": "application/json",
"method": "POST",
"pagination": false,
"parameters": [],
"path": "/v1/input",
"selected_compression": "deflate"
},
"scenario": "Send deflate logs returns \"Response from server (always 200 empty JSON).\" response",
"schema_version": 1,
"version": "v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"api": "Logs",
"expected_status": 200,
"feature": "Logs",
"id": "v1/Logs/Send gzip logs returns \"Response from server (always 200 empty JSON).\" response",
"operation_id": "SubmitLog",
"request": {
"body": {
"schema": {
"format": null,
"items": {
"format": null,
"ref": "HTTPLogItem",
"type": "object"
},
"ref": "HTTPLog",
"type": "array"
},
"source": "inline",
"value": [
{
"ddtags": "host:{{ unique_alnum }}",
"message": "{{ unique }}"
}
]
},
"compression": "gzip",
"content_type": "application/json",
"method": "POST",
"pagination": false,
"parameters": [],
"path": "/v1/input",
"selected_compression": "gzip"
},
"scenario": "Send gzip logs returns \"Response from server (always 200 empty JSON).\" response",
"schema_version": 1,
"version": "v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"api": "Logs",
"expected_status": 202,
"feature": "Logs",
"id": "v2/Logs/Send deflate logs returns \"Request accepted for processing (always 202 empty JSON).\" response",
"operation_id": "SubmitLog",
"request": {
"body": {
"schema": {
"format": null,
"items": {
"format": null,
"ref": "HTTPLogItem",
"type": "object"
},
"ref": "HTTPLog",
"type": "array"
},
"source": "inline",
"value": [
{
"ddsource": "nginx",
"ddtags": "env:staging,version:5.1",
"hostname": "i-012345678",
"message": "2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World",
"service": "payment"
}
]
},
"compression": "deflate",
"content_type": "application/json",
"method": "POST",
"pagination": false,
"parameters": [],
"path": "/api/v2/logs",
"selected_compression": "deflate"
},
"scenario": "Send deflate logs returns \"Request accepted for processing (always 202 empty JSON).\" response",
"schema_version": 1,
"version": "v2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"api": "Logs",
"expected_status": 202,
"feature": "Logs",
"id": "v2/Logs/Send gzip logs returns \"Request accepted for processing (always 202 empty JSON).\" response",
"operation_id": "SubmitLog",
"request": {
"body": {
"schema": {
"format": null,
"items": {
"format": null,
"ref": "HTTPLogItem",
"type": "object"
},
"ref": "HTTPLog",
"type": "array"
},
"source": "inline",
"value": [
{
"ddsource": "nginx",
"ddtags": "env:staging,version:5.1",
"hostname": "i-012345678",
"message": "2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World",
"service": "payment"
}
]
},
"compression": "gzip",
"content_type": "application/json",
"method": "POST",
"pagination": false,
"parameters": [],
"path": "/api/v2/logs",
"selected_compression": "gzip"
},
"scenario": "Send gzip logs returns \"Request accepted for processing (always 202 empty JSON).\" response",
"schema_version": 1,
"version": "v2"
}
74 changes: 74 additions & 0 deletions src/test/resources/generated-test/test-server-data/v1/logs.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,80 @@
"scenario": "Search test logs returns \"OK\" response",
"version": "v1"
},
{
"feature": "Logs",
"frozen_at": "2026-02-02T02:40:00.000Z",
"interactions": [
{
"request": {
"body": {
"type": "json",
"value": [
{
"ddtags": "host:TestSenddeflatelogsreturnsResponsefromserveralways200emptyJSONresponse1770000000",
"message": "Test-Send_deflate_logs_returns_Response_from_server_always_200_empty_JSON_response-1770000000"
}
]
},
"compression": "deflate",
"content_type": "application/json",
"method": "POST",
"path": "/v1/input",
"query": []
},
"response": {
"body": {
"encoding": "text",
"value": "{}"
},
"headers": {
"content-type": "application/json"
},
"reason": "OK",
"status": 200
}
}
],
"scenario": "Send deflate logs returns \"Response from server (always 200 empty JSON).\" response",
"version": "v1"
},
{
"feature": "Logs",
"frozen_at": "2026-02-02T02:40:00.000Z",
"interactions": [
{
"request": {
"body": {
"type": "json",
"value": [
{
"ddtags": "host:TestSendgziplogsreturnsResponsefromserveralways200emptyJSONresponse1770000000",
"message": "Test-Send_gzip_logs_returns_Response_from_server_always_200_empty_JSON_response-1770000000"
}
]
},
"compression": "gzip",
"content_type": "application/json",
"method": "POST",
"path": "/v1/input",
"query": []
},
"response": {
"body": {
"encoding": "text",
"value": "{}"
},
"headers": {
"content-type": "application/json"
},
"reason": "OK",
"status": 200
}
}
],
"scenario": "Send gzip logs returns \"Response from server (always 200 empty JSON).\" response",
"version": "v1"
},
{
"feature": "Logs",
"frozen_at": "2022-04-12T14:46:46.337Z",
Expand Down
Loading
Loading