Skip to content

Commit 75a5ef7

Browse files
committed
Add e2e test for unframed requests
Signed-off-by: Tomas Longo <tlongo@sternad.de>
1 parent 83d7b39 commit 75a5ef7

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

e2e-test/log/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ List<LogTestConfiguration> logTestConfigurations = [
8484
'otel-logs-source-pipeline.yml',
8585
'data_prepper.yml'
8686
),
87+
new LogTestConfiguration(
88+
'basicLogOtelLogsSourceGrpcUnframedRequestsEndToEndTest',
89+
'Runs the basic end-to-end test using the otel logs source grpc service with unframed requests enabled.',
90+
'org.opensearch.dataprepper.integration.log.EndToEndOtelLogsSourceTest.testOtelLogsSourceWithUnframedRequestsPipelineEndToEnd*',
91+
'data-prepper-otel-logs-source',
92+
'otel-logs-source-unframed-requests-pipeline.yml',
93+
'data_prepper.yml'
94+
),
8795
]
8896

8997

e2e-test/log/src/integrationTest/java/org/opensearch/dataprepper/integration/log/EndToEndOtelLogsSourceTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,19 @@ public class EndToEndOtelLogsSourceTest {
5656

5757
@Test
5858
public void testOtelLogsSourcePipelineEndToEnd() throws InvalidProtocolBufferException {
59-
ingestLogs();
59+
ingestLogs("/otel-logs-pipeline/logs");
6060

6161
searchForLogsAndAssert();
6262
}
6363

64+
@Test
65+
public void testOtelLogsSourceWithUnframedRequestsPipelineEndToEnd() throws InvalidProtocolBufferException {
66+
ingestLogs("/opentelemetry.proto.collector.logs.v1.LogsService/Export");
67+
68+
searchForLogsAndAssert();
69+
}
70+
71+
6472
private HttpData createOtelLogsHttpRequest() throws InvalidProtocolBufferException {
6573
ExportLogsServiceRequest exportLogsServiceRequest = ExportLogsServiceRequest.newBuilder().addResourceLogs(
6674
ResourceLogs.newBuilder()
@@ -101,12 +109,12 @@ private RestHighLevelClient createOpenSearchClient() {
101109
.createClient(null);
102110
}
103111

104-
private void ingestLogs() throws InvalidProtocolBufferException {
112+
private void ingestLogs(String path) throws InvalidProtocolBufferException {
105113
RequestHeaders headers = RequestHeaders.builder()
106114
.scheme(SessionProtocol.HTTP)
107115
.authority(String.format("127.0.0.1:%d", SOURCE_PORT))
108116
.method(HttpMethod.POST)
109-
.path("/otel-logs-pipeline/logs")
117+
.path(path)
110118
.contentType(MediaType.JSON_UTF_8)
111119
.build();
112120

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
otel-logs-pipeline:
2+
workers: 2
3+
source:
4+
otel_logs_source:
5+
http_path: "/${pipelineName}/logs"
6+
port: 2021
7+
ssl: false
8+
unframed_requests: true
9+
sink:
10+
- opensearch:
11+
hosts: [ "https://node-0.example.com:9200" ]
12+
username: "admin"
13+
password: "admin"
14+
insecure: true
15+
index: "otel-logs-index"
16+
flush_timeout: 5000

0 commit comments

Comments
 (0)