#include "envoy/config/trace/v3/datadog.pb.h" #include "envoy/config/trace/v3/datadog.pb.validate.h" #include "envoy/config/trace/v3/http_tracer.pb.h" #include "extensions/tracers/datadog/config.h" #include "test/mocks/server/tracer_factory.h" #include "test/mocks/server/tracer_factory_context.h" #include "gmock/gmock.h" #include "gtest/gtest.h" using testing::Eq; using testing::NiceMock; using testing::Return; namespace Envoy { namespace Extensions { namespace Tracers { namespace Datadog { namespace { TEST(DatadogTracerConfigTest, DatadogHttpTracer) { NiceMock context; context.server_factory_context_.cluster_manager_.initializeClusters({"fake_cluster"}, {}); const std::string yaml_string = R"EOF( http: name: datadog typed_config: "@type": type.googleapis.com/envoy.config.trace.v3.DatadogConfig collector_cluster: fake_cluster service_name: fake_file )EOF"; envoy::config::trace::v3::Tracing configuration; TestUtility::loadFromYaml(yaml_string, configuration); DatadogTracerFactory factory; auto message = Config::Utility::translateToFactoryConfig( configuration.http(), ProtobufMessage::getStrictValidationVisitor(), factory); Tracing::HttpTracerSharedPtr datadog_tracer = factory.createHttpTracer(*message, context); EXPECT_NE(nullptr, datadog_tracer); } } // namespace } // namespace Datadog } // namespace Tracers } // namespace Extensions } // namespace Envoy