Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
describe 'Lambda' do
let(:service_name) { 'Lambda' }
let(:service_uri) do
'https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/'
'https://lambda.us-east-1.amazonaws.com/2015-03-31/functions'
end
let(:client) do
Aws::Lambda::Client.new(
Expand Down Expand Up @@ -82,7 +82,7 @@

it 'creates spans with all the non-stubbed parameters' do
skip unless TestHelper.telemetry_plugin?(service_name)
stub_request(:get, 'https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/')
stub_request(:get, 'https://lambda.us-east-1.amazonaws.com/2015-03-31/functions')

client = Aws::Lambda::Client.new(
telemetry_provider: otel_provider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
end

it 'does not create a span on connect when request ignored using a regexp' do
# this works because http://bazqux.com is reachable site; try http://asdfasdfsef.com will fail
uri = URI.parse('http://bazqux.com')
http = Net::HTTP.new(uri.host, uri.port)
http.send(:connect)
Expand All @@ -169,7 +170,16 @@
it 'creates a span on connect for a non-ignored request' do
uri = URI.parse('http://example.com')
http = Net::HTTP.new(uri.host, uri.port)
http.send(:connect)

fake_socket = Object.new
def fake_socket.setsockopt(*args); end
def fake_socket.close; end

# Replace the TCP socket creation with our fake socket
TCPSocket.stub(:open, fake_socket) do
http.send(:connect)
end

http.send(:do_finish)
_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal('connect')
Expand Down Expand Up @@ -199,6 +209,10 @@
OpenTelemetry::Common::Utilities.untraced do
uri = URI.parse('http://example.com/body')
http = Net::HTTP.new(uri.host, uri.port)

# Mock the connect
http.define_singleton_method(:connect) { true }

http.send(:connect)
http.send(:do_finish)
end
Expand Down
Loading