From 97c267337db1700e017ee907469ca8e7b5f92cd8 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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb b/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb index d4d6f3b8354..ed64bfe8612 100644 --- a/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb +++ b/spec/datadog/tracing/contrib/elasticsearch/transport_spec.rb @@ -177,7 +177,15 @@ def call(env) describe 'client 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' }