Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Feb 17, 2025
1 parent ea1f28e commit 65bafad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
38 changes: 16 additions & 22 deletions sentry-ruby/spec/sentry/net/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,32 @@
::Logger.new(string_io)
end

context "with IPv6 addresses" do
context "with tracing enabled" do
before do
perform_basic_setup do |config|
config.traces_sample_rate = 1.0
config.transport.transport_class = Sentry::HTTPTransport
config.logger = logger
# the dsn needs to have a real host so we can make a real connection before sending a failed request
config.dsn = 'http://foobarbaz@o447951.ingest.sentry.io/5434472'
end
end

it "correctly parses the short-hand IPv6 addresses" do
stub_normal_response

transaction = Sentry.start_transaction
Sentry.get_current_scope.set_span(transaction)
context "with IPv6 addresses" do
it "correctly parses the short-hand IPv6 addresses" do
stub_normal_response

_ = Net::HTTP.get("::1", "/path", 8080)
transaction = Sentry.start_transaction
Sentry.get_current_scope.set_span(transaction)

expect(transaction.span_recorder.spans.count).to eq(2)
_ = Net::HTTP.get("::1", "/path", 8080)

request_span = transaction.span_recorder.spans.last
expect(request_span.data).to eq(
{ "url" => "http://[::1]/path", "http.request.method" => "GET", "http.response.status_code" => 200 }
)
end
end
expect(transaction.span_recorder.spans.count).to eq(2)

context "with tracing enabled" do
before do
perform_basic_setup do |config|
config.traces_sample_rate = 1.0
config.transport.transport_class = Sentry::HTTPTransport
config.logger = logger
# the dsn needs to have a real host so we can make a real connection before sending a failed request
config.dsn = 'http://foobarbaz@o447951.ingest.sentry.io/5434472'
request_span = transaction.span_recorder.spans.last
expect(request_span.data).to eq(
{ "url" => "http://[::1]/path", "http.request.method" => "GET", "http.response.status_code" => 200 }
)
end
end

Expand Down
1 change: 1 addition & 0 deletions sentry-ruby/spec/sentry/rspec/matchers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
config.dsn = 'https://2fb45f003d054a7ea47feb45898f7649@o447951.ingest.sentry.io/5434472'
config.enabled_environments = ["production"]
config.environment = :test
config.transport.transport_class = Sentry::DummyTransport
end

setup_sentry_test
Expand Down

0 comments on commit 65bafad

Please sign in to comment.