Skip to content

Commit

Permalink
test: Resolve Truffle ruby intermittent failures on exporters (#1752)
Browse files Browse the repository at this point in the history
* test: Use Zlib.gunzip to compare body with estr

Zlib.gzip adds a timestamp, which may be different than the one in the
encoded req.body due to the test timing, and may cause an intermittent
failure. Compare the unzipped request with the encoded_estr to avoid
the timestamp interfering with the equality check.

Co-authored-by: Tanna McClure <tannalynn@users.noreply.github.com>

* test: Remove skip for TruffleRuby

The assertions in this test differ from the other intermittent failures.
Hopefully, the test is not failing and was skipped because the name
of the test is the same as others.

* chore: Remove comment

---------

Co-authored-by: Tanna McClure <tannalynn@users.noreply.github.com>
  • Loading branch information
kaylareopelle and tannalynn authored Oct 22, 2024
1 parent 4c9f7e1 commit 0c372cd
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
end

it 'translates all the things' do
# TODO: See issue #1507 to fix
skip 'Intermittently fails' if RUBY_ENGINE == 'truffleruby'

OpenTelemetry.tracer_provider = OpenTelemetry::SDK::Trace::TracerProvider.new(resource: OpenTelemetry::SDK::Resources::Resource.telemetry_sdk)
tracer = OpenTelemetry.tracer_provider.tracer('tracer', 'v0.0.1')
other_tracer = OpenTelemetry.tracer_provider.tracer('other_tracer')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,6 @@
end

it 'translates all the things' do
# TODO: See issue #1507 to fix
skip 'Intermittently fails' if RUBY_ENGINE == 'truffleruby'

stub_request(:post, 'http://localhost:4318/v1/traces').to_return(status: 200)
processor = OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(exporter)
tracer = OpenTelemetry.tracer_provider.tracer('tracer', 'v0.0.1')
Expand Down Expand Up @@ -635,7 +632,7 @@
)

assert_requested(:post, 'http://localhost:4318/v1/traces') do |req|
req.body == Zlib.gzip(encoded_etsr)
Zlib.gunzip(req.body) == encoded_etsr
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,6 @@
end

it 'translates all the things' do
skip 'Intermittently fails' if RUBY_ENGINE == 'truffleruby'

stub_request(:post, 'http://localhost:4318/v1/metrics').to_return(status: 200)
meter_provider.add_metric_reader(exporter)
meter = meter_provider.meter('test')
Expand Down Expand Up @@ -639,7 +637,7 @@
)

assert_requested(:post, 'http://localhost:4318/v1/metrics') do |req|
req.body == Zlib.gzip(encoded_etsr) # is asserting that the body of the HTTP request is equal to the result of gzipping the encoded_etsr.
Zlib.gunzip(req.body) == encoded_etsr
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,6 @@
end

it 'translates all the things' do
# TODO: See issue #1507 to fix
skip 'Intermittently fails' if RUBY_ENGINE == 'truffleruby'

stub_request(:post, 'http://localhost:4318/v1/traces').to_return(status: 200)
processor = OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(exporter)
tracer = OpenTelemetry.tracer_provider.tracer('tracer', 'v0.0.1')
Expand Down Expand Up @@ -778,7 +775,7 @@
)

assert_requested(:post, 'http://localhost:4318/v1/traces') do |req|
req.body == Zlib.gzip(encoded_etsr)
Zlib.gunzip(req.body) == encoded_etsr
end
end
end
Expand Down

0 comments on commit 0c372cd

Please sign in to comment.