Skip to content

[W3C] Refactor W3C integration tests #6328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

martincostello
Copy link
Member

Changes

Improve developer experience when troubleshooting failing tests (like I was in #6307) by logging both stderr and stdout and ignoring warnings in the upstream Python tests.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

Copy link

codecov bot commented Jun 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.74%. Comparing base (dde8f40) to head (e6fc093).
Report is 6 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6328      +/-   ##
==========================================
- Coverage   86.76%   86.74%   -0.02%     
==========================================
  Files         258      258              
  Lines       11879    11879              
==========================================
- Hits        10307    10305       -2     
- Misses       1572     1574       +2     
Flag Coverage Δ
unittests-Project-Experimental 86.66% <ø> (+0.10%) ⬆️
unittests-Project-Stable 86.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 2 files with indirect coverage changes

@martincostello martincostello marked this pull request as ready for review June 13, 2025 11:10
@Copilot Copilot AI review requested due to automatic review settings June 13, 2025 11:10
@martincostello martincostello requested a review from a team as a code owner June 13, 2025 11:10
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Refactors W3C integration tests to capture both stdout and stderr and ignore Python warnings, improving failure diagnostics.

  • Passes the -W ignore flag to suppress upstream warnings in Python tests.
  • Changes RunCommand to return both stdout and stderr.
  • Updates test logic to log and parse the new streams.
Comments suppressed due to low confidence (2)

test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/W3CTraceContextTests.cs:89

  • [nitpick] The new tuple return type would benefit from an XML doc comment summarizing the meaning of StdOut and StdErr, improving maintainability and discoverability.
private static (string StdOut, string StdErr) RunCommand(string command, string args)

test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/W3CTraceContextTests.cs:71

  • [nitpick] Consider adding a unit test or integration test for RunCommand to verify correct separation of stdout and stderr and the fallback parsing behavior.
(var stdout, var stderr) = RunCommand("python", "-W ignore trace-context/test/test.py http://localhost:5000/");

Comment on lines 106 to 111
var stdout = proc.StandardOutput.ReadToEnd();
var stderr = proc.StandardError.ReadToEnd();

proc.WaitForExit();
return results;

return (stdout, stderr);
Copy link
Preview

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

Sequential calls to ReadToEnd on both StandardOutput and StandardError can lead to deadlocks for large outputs; consider using asynchronous reading (e.g., BeginOutputReadLine) or reading both streams in parallel.

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have some code of my own that does this I can copy over here if a human reviewer wants me to.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it's better to cover it. Later, if we encounter such issues, it will be very difficult to troubleshoot and determine if the issue is due to this reason.

@martincostello martincostello force-pushed the improve-wc3-tests branch 2 times, most recently from f4c51cd to 8b117f0 Compare June 18, 2025 14:09
Improve developer experience when troubleshooting failing tests (like I was in open-telemetry#6307) by logging both stderr and stdout and ignoring warnings in the upstream Python tests.
Updated W3CTraceContextTestSuiteAsync and RunCommand to be asynchronous, improving process output handling and cancellation. Added helper methods to asynchronously consume process output and error streams, ensuring proper resource clean-up and more robust test execution.
@rajkumar-rangaraj rajkumar-rangaraj merged commit 154a6dc into open-telemetry:main Jun 19, 2025
31 checks passed
@martincostello martincostello deleted the improve-wc3-tests branch June 19, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants