Skip to content

fix(Instrumentation-HttpClient): improve test coverage#2196

Open
GRISONRF wants to merge 8 commits intoopen-telemetry:mainfrom
GRISONRF:fix/instrumentation-httpclient-test-coverage
Open

fix(Instrumentation-HttpClient): improve test coverage#2196
GRISONRF wants to merge 8 commits intoopen-telemetry:mainfrom
GRISONRF:fix/instrumentation-httpclient-test-coverage

Conversation

@GRISONRF
Copy link
Copy Markdown

Fixes #2158

Changes:

  • Removed skip unless ENV['BUNDLE_GEMFILE'].include?('stable') guard from instrumentation_test.rb.

  • Removed #install accepts argument test as it caused intermittent double-prepend failures depending on test execution order (this is my first time coding in Ruby, and if I understood correctly, Ruby's prepend is permanent within a process, right? So calling install in this test file, which runs alongside other test files that also call install, can stack patches multiple times depending on random seed order, leading to unpredictable failures -please someone correct me if I'm wrong)

  • Added explicit determine_semconv tests to cover the dup, old, and stable branching logic, which was previously only covered indirectly.

Verified locally and all 3 appraisals pass with 0 failures, 0 errors, and coverage of 100%, SimpleCov.minimum_coverage(85) passes, and RuboCop passes on the changed file.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Apr 10, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@GRISONRF GRISONRF changed the title Fix/instrumentation httpclient test coverage fix(instrumentation-httpclient): improve test coverage Apr 14, 2026
@github-actions github-actions Bot added the ci label Apr 21, 2026
@thompson-tomo thompson-tomo changed the title fix(instrumentation-httpclient): improve test coverage fix(Instrumentation-HttpClient): improve test coverage Apr 21, 2026
describe 'determine_semconv' do
it 'returns "dup" when OTEL_SEMCONV_STABILITY_OPT_IN includes http/dup' do
OpenTelemetry::TestHelpers.with_env('OTEL_SEMCONV_STABILITY_OPT_IN' => 'http/dup') do
_(instrumentation.send(:determine_semconv)).must_equal('dup')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hannahramadan Is there another way to address this? It seems to me that breaking encapsulation for the purposes of testing is probably not the best way to validate this or increase coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve http_client instrumentation test coverage

3 participants