Skip to content

Commit

Permalink
Verify port equivalence
Browse files Browse the repository at this point in the history
  • Loading branch information
tt committed Jun 16, 2024
1 parent a42aa74 commit 49d0d63
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@
end

it 'emits span on connect' do
port = nil

TCPServer.open('localhost', 0) do |server|
Thread.start do
server.accept
Expand All @@ -231,6 +233,7 @@
_(span.name).must_equal 'connect'
_(span.attributes['net.peer.name']).must_equal('localhost')
_(span.attributes['net.peer.port']).wont_be_nil
_(span.attributes['net.peer.port']).must_equal(port)

assert_http_spans(target: '/example', exception: 'Excon::Error::Timeout')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

describe '#connect' do
it 'emits span on connect' do
port = nil

WebMock.allow_net_connect!
TCPServer.open('localhost', 0) do |server|
Thread.start { server.accept }
Expand All @@ -38,6 +40,7 @@
_(span.name).must_equal 'HTTP CONNECT'
_(span.attributes['net.peer.name']).must_equal('localhost')
_(span.attributes['net.peer.port']).wont_be_nil
_(span.attributes['net.peer.port']).must_equal(port)
ensure
WebMock.disable_net_connect!
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@

describe '#connect' do
it 'emits span on connect' do
port = nil

WebMock.allow_net_connect!
TCPServer.open('localhost', 0) do |server|
Thread.start { server.accept }
Expand All @@ -225,6 +227,7 @@
_(span.name).must_equal 'connect'
_(span.attributes['net.peer.name']).must_equal('localhost')
_(span.attributes['net.peer.port']).wont_be_nil
_(span.attributes['net.peer.port']).must_equal(port)
ensure
WebMock.disable_net_connect!
end
Expand Down

0 comments on commit 49d0d63

Please sign in to comment.