From 821f631248a36ee6f7f8177325ab20cfa446981a Mon Sep 17 00:00:00 2001 From: Edmund Kump Date: Fri, 26 Jan 2024 16:50:43 -0500 Subject: [PATCH] update test to set correct transport object --- .../tracing/contrib/elasticsearch/transport_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb b/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb index d4d6f3b8354..a974dc9bb21 100644 --- a/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb +++ b/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb @@ -175,9 +175,17 @@ def call(env) end end - describe 'client configuration override' do + describe 'transport configuration override' do context 'when #service is overridden' do - before { Datadog.configure_onto(client.transport, service_name: service_name) } + let(:version_greater_than_8) { Gem::Version.new(::Elasticsearch::VERSION) >= Gem::Version.new('8.0.0') } + + before do + if version_greater_than_8 + Datadog.configure_onto(client.transport, service_name: service_name) + else + Datadog.configure_onto(client.transport.transport, service_name: service_name) + end + end let(:service_name) { 'bar' }