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

[TEST] Functional tests for OTLP/gRPC with mutual TLS #3227

Merged
merged 6 commits into from
Jan 6, 2025
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
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,15 @@ jobs:
run: |
sudo ./ci/setup_grpc.sh
./ci/do_ci.sh cmake.exporter.otprotocol.test
- name: generate test cert
Copy link
Contributor Author

@chusitoo chusitoo Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reusing this test because it is the only one enabling WITH_OTLP_GRPC_SSL_MTLS_PREVIEW and also WITH_OTLP_GRPC so it sort of made sense to add functional tests to it

env:
CFSSL_VERSION: 1.6.3
run: |
sudo -E ./tools/setup-cfssl.sh
(cd ./functional/cert; ./generate_cert.sh)
- name: run func test
run: |
(cd ./functional/otlp; ./run_test.sh)

cmake_modern_protobuf_grpc_with_abseil_test:
name: CMake test (with modern protobuf,grpc and abseil)
Expand Down
6 changes: 6 additions & 0 deletions exporters/otlp/src/otlp_grpc_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ sdk::common::ExportResult OtlpGrpcExporter::Export(
else
{
#endif
const auto resource_spans_size = request->resource_spans_size();
grpc::Status status =
OtlpGrpcClient::DelegateExport(trace_service_stub_.get(), std::move(context),
std::move(arena), std::move(*request), response);
Expand All @@ -160,6 +161,11 @@ sdk::common::ExportResult OtlpGrpcExporter::Export(
<< "\" error_message: \"" << status.error_message() << "\"");
return sdk::common::ExportResult::kFailure;
}
else
{
OTEL_INTERNAL_LOG_DEBUG("[OTLP TRACE GRPC Exporter] Export " << resource_spans_size
<< " trace span(s) success");
}
#ifdef ENABLE_ASYNC_EXPORT
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions functional/otlp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

include_directories(${CMAKE_SOURCE_DIR}/exporters/otlp/include)

if(WITH_OTLP_GRPC)
add_executable(func_otlp_grpc func_grpc_main.cc)
target_link_libraries(func_otlp_grpc ${CMAKE_THREAD_LIBS_INIT}
opentelemetry_trace opentelemetry_exporter_otlp_grpc)
endif()

if(WITH_OTLP_HTTP)
add_executable(func_otlp_http func_http_main.cc)
target_link_libraries(func_otlp_http ${CMAKE_THREAD_LIBS_INIT}
Expand Down
1 change: 1 addition & 0 deletions functional/otlp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
FROM otel/opentelemetry-collector
COPY . .
CMD ["--config", "/otel-cpp/otel-config.yaml"]
EXPOSE 4317
EXPOSE 4318
Loading
Loading