|
6 | 6 | RSpec.describe Sentry::Net::HTTP do
|
7 | 7 | include_context "with request mock"
|
8 | 8 |
|
9 |
| - around do |example| |
10 |
| - WebMock.disable! |
11 |
| - example.run |
12 |
| - WebMock.enable! |
13 |
| - end |
14 |
| - |
15 | 9 | let(:string_io) { StringIO.new }
|
16 | 10 | let(:logger) do
|
17 | 11 | ::Logger.new(string_io)
|
18 | 12 | end
|
19 | 13 |
|
20 |
| - context "with IPv6 addresses" do |
| 14 | + context "with tracing enabled" do |
21 | 15 | before do
|
22 | 16 | perform_basic_setup do |config|
|
23 | 17 | config.traces_sample_rate = 1.0
|
| 18 | + config.transport.transport_class = Sentry::HTTPTransport |
| 19 | + config.logger = logger |
| 20 | + # the dsn needs to have a real host so we can make a real connection before sending a failed request |
| 21 | + config.dsn = 'http://[email protected]/5434472' |
24 | 22 | end
|
25 | 23 | end
|
26 | 24 |
|
27 |
| - it "correctly parses the short-hand IPv6 addresses" do |
28 |
| - stub_normal_response |
29 |
| - |
30 |
| - transaction = Sentry.start_transaction |
31 |
| - Sentry.get_current_scope.set_span(transaction) |
| 25 | + context "with IPv6 addresses" do |
| 26 | + it "correctly parses the short-hand IPv6 addresses" do |
| 27 | + stub_normal_response |
32 | 28 |
|
33 |
| - _ = Net::HTTP.get("::1", "/path", 8080) |
| 29 | + transaction = Sentry.start_transaction |
| 30 | + Sentry.get_current_scope.set_span(transaction) |
34 | 31 |
|
35 |
| - expect(transaction.span_recorder.spans.count).to eq(2) |
| 32 | + _ = Net::HTTP.get("::1", "/path", 8080) |
36 | 33 |
|
37 |
| - request_span = transaction.span_recorder.spans.last |
38 |
| - expect(request_span.data).to eq( |
39 |
| - { "url" => "http://[::1]/path", "http.request.method" => "GET", "http.response.status_code" => 200 } |
40 |
| - ) |
41 |
| - end |
42 |
| - end |
| 34 | + expect(transaction.span_recorder.spans.count).to eq(2) |
43 | 35 |
|
44 |
| - context "with tracing enabled" do |
45 |
| - before do |
46 |
| - perform_basic_setup do |config| |
47 |
| - config.traces_sample_rate = 1.0 |
48 |
| - config.transport.transport_class = Sentry::HTTPTransport |
49 |
| - config.logger = logger |
50 |
| - # the dsn needs to have a real host so we can make a real connection before sending a failed request |
51 |
| - config.dsn = 'http://[email protected]/5434472' |
| 36 | + request_span = transaction.span_recorder.spans.last |
| 37 | + expect(request_span.data).to eq( |
| 38 | + { "url" => "http://[::1]/path", "http.request.method" => "GET", "http.response.status_code" => 200 } |
| 39 | + ) |
52 | 40 | end
|
53 | 41 | end
|
54 | 42 |
|
|
0 commit comments