-
Notifications
You must be signed in to change notification settings - Fork 826
[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
[W3C] Refactor W3C integration tests #6328
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this 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
andStdErr
, 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/");
test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/W3CTraceContextTests.cs
Show resolved
Hide resolved
var stdout = proc.StandardOutput.ReadToEnd(); | ||
var stderr = proc.StandardError.ReadToEnd(); | ||
|
||
proc.WaitForExit(); | ||
return results; | ||
|
||
return (stdout, stderr); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
f4c51cd
to
8b117f0
Compare
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.
8b117f0
to
e6fc093
Compare
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
CHANGELOG.md
files updated for non-trivial changes