diff --git a/spec/datadog/tracing/contrib/ethon/easy_patch_spec.rb b/spec/datadog/tracing/contrib/ethon/easy_patch_spec.rb index 6d6021cf33c..45d5a1bf85d 100644 --- a/spec/datadog/tracing/contrib/ethon/easy_patch_spec.rb +++ b/spec/datadog/tracing/contrib/ethon/easy_patch_spec.rb @@ -6,11 +6,9 @@ require 'datadog/tracing/contrib/ethon/shared_examples' require 'datadog/tracing/contrib/analytics_examples' -require 'spec/datadog/tracing/contrib/ethon/support/thread_helpers' - RSpec.describe Datadog::Tracing::Contrib::Ethon::EasyPatch do let(:configuration_options) { {} } - let(:easy) { EthonSupport.ethon_easy_new } + let(:easy) { Ethon::Easy.new } let(:server_error_statuses) { nil } before do @@ -252,7 +250,7 @@ context 'when basic auth in url' do it 'does not collect auth info' do - easy = EthonSupport.ethon_easy_new(url: 'http://username:pasword@example.com/sample/path') + easy = Ethon::Easy.new(url: 'http://username:pasword@example.com/sample/path') easy.perform @@ -263,7 +261,7 @@ context 'when query string in url' do it 'does not collect query string' do - easy = EthonSupport.ethon_easy_new(url: 'http://example.com/sample/path?foo=bar') + easy = Ethon::Easy.new(url: 'http://example.com/sample/path?foo=bar') easy.perform diff --git a/spec/datadog/tracing/contrib/ethon/integration_test_spec.rb b/spec/datadog/tracing/contrib/ethon/integration_test_spec.rb index be11f2a5168..34317898562 100644 --- a/spec/datadog/tracing/contrib/ethon/integration_test_spec.rb +++ b/spec/datadog/tracing/contrib/ethon/integration_test_spec.rb @@ -9,14 +9,12 @@ require 'datadog/tracing/contrib/support/spec_helper' require 'datadog/tracing/contrib/support/http' -require 'spec/datadog/tracing/contrib/ethon/support/thread_helpers' - RSpec.describe 'Ethon integration tests' do skip_unless_integration_testing_enabled context 'with Easy HTTP request' do subject(:request) do - easy = EthonSupport.ethon_easy_new + easy = Ethon::Easy.new easy.http_request(url, 'GET', params: query, timeout_ms: timeout * 1000) easy.perform # Use Typhoeus response wrapper to simplify tests @@ -67,7 +65,7 @@ context 'with simple Easy & headers override' do subject(:request) do - easy = EthonSupport.ethon_easy_new(url: url) + easy = Ethon::Easy.new(url: url) easy.customrequest = 'GET' easy.set_attributes(timeout_ms: timeout * 1000) easy.headers = request_headers @@ -104,7 +102,7 @@ context 'with single Multi request' do subject(:request) do multi = Ethon::Multi.new - easy = EthonSupport.ethon_easy_new + easy = Ethon::Easy.new easy.http_request(url, 'GET', params: query, timeout_ms: timeout * 1000) multi.add(easy) multi.perform diff --git a/spec/datadog/tracing/contrib/ethon/multi_patch_spec.rb b/spec/datadog/tracing/contrib/ethon/multi_patch_spec.rb index 063e39f576c..553e8c62082 100644 --- a/spec/datadog/tracing/contrib/ethon/multi_patch_spec.rb +++ b/spec/datadog/tracing/contrib/ethon/multi_patch_spec.rb @@ -7,8 +7,6 @@ require 'datadog/tracing/contrib/environment_service_name_examples' require 'datadog/tracing/contrib/span_attribute_schema_examples' -require 'spec/datadog/tracing/contrib/ethon/support/thread_helpers' - RSpec.describe Datadog::Tracing::Contrib::Ethon::MultiPatch do let(:configuration_options) { {} } @@ -26,7 +24,7 @@ end describe '#add' do - let(:easy) { EthonSupport.ethon_easy_new } + let(:easy) { Ethon::Easy.new } let(:span) { easy.instance_eval { @datadog_span } } let(:multi_span) { multi.instance_eval { @datadog_multi_span } } let(:multi) { ::Ethon::Multi.new } @@ -61,7 +59,7 @@ end describe '#perform' do - let(:easy) { EthonSupport.ethon_easy_new } + let(:easy) { Ethon::Easy.new } let(:easy_span) { spans.find { |span| span.name == 'ethon.request' } } let(:multi_span) { spans.find { |span| span.name == 'ethon.multi.request' } } let(:multi) { ::Ethon::Multi.new } diff --git a/spec/datadog/tracing/contrib/ethon/support/thread_helpers.rb b/spec/datadog/tracing/contrib/ethon/support/thread_helpers.rb deleted file mode 100644 index 3b62d8b2d9c..00000000000 --- a/spec/datadog/tracing/contrib/ethon/support/thread_helpers.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec/support/thread_helpers' -require 'ethon' - -module EthonSupport - module_function - - # Ethon will lazily initialize LibCurl, - # which spans a leaky native thread. - # - # LibCurl is normally first initialized when - # a new instance of Ethon::Easy is created. - # We tag the newly created thread in the :ethon - # group to allow for later reporting. - # - # This tagging allows us to still ensure that the integration - # itself is leak-free. - def ethon_easy_new(*args) - ThreadHelpers.with_leaky_thread_creation(:ethon) do - Ethon::Easy.new(*args) - end - end -end diff --git a/spec/datadog/tracing/contrib/ethon/typhoeus_integration_spec.rb b/spec/datadog/tracing/contrib/ethon/typhoeus_integration_spec.rb index a99b55166c1..4fc982f55c1 100644 --- a/spec/datadog/tracing/contrib/ethon/typhoeus_integration_spec.rb +++ b/spec/datadog/tracing/contrib/ethon/typhoeus_integration_spec.rb @@ -2,7 +2,6 @@ require 'datadog/tracing/contrib/ethon/shared_examples' require 'datadog/tracing/contrib/ethon/integration_context' -require 'spec/datadog/tracing/contrib/ethon/support/thread_helpers' RSpec.describe Datadog::Tracing::Contrib::Ethon do skip_unless_integration_testing_enabled @@ -18,7 +17,7 @@ # # This allows us to still ensure that the integration # itself is leak-free. - EthonSupport.ethon_easy_new + Ethon::Easy.new end context 'with Typhoeus request' do