Skip to content
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

Make coverage results more stable #1293

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

mszabo-wikia
Copy link
Contributor

Which problem is this PR solving?

  • Makes coverage checks more stable

Short description of the changes

Coverage results are currently flaky because
src/components/TracePage/index.test.js uses randomly generated trace data to integration test the page, which sometimes covers code paths in tableValues.tsx not covered by its own unit tests. Attempt to make things more stable by extending unit test coverage for tableValues.tsx.

@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (c10aa5b) 95.58% compared to head (cbd49dd) 95.58%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1293   +/-   ##
=======================================
  Coverage   95.58%   95.58%           
=======================================
  Files         244      244           
  Lines        7651     7651           
  Branches     2006     2006           
=======================================
  Hits         7313     7313           
  Misses        338      338           
Impacted Files Coverage Δ
...mponents/TracePage/TraceStatistics/tableValues.tsx 99.33% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mszabo-wikia
Copy link
Contributor Author

Looks like there's 1 line left still

@yurishkuro
Copy link
Member

Wanna fix it before merging?

Also, how are you finding which lines' coverage changes? Codecov.io keeps breaking for me, refuses to show diffs.

@mszabo-wikia
Copy link
Contributor Author

Yeah, I just need to come up with a good trace that can be used to test it—it's been proving elusive so far.

For determining coverage,

$ yarn test --coverage --collectCoverageFrom src/components/TracePage/TraceStatistics/tableValues.tsx

is useful to observe how coverage results for this single file change over multiple executions of the entire suite, and

$ yarn test --coverage --collectCoverageFrom src/components/TracePage/TraceStatistics/tableValues.tsx src/components/TracePage/index.test.js

does the same but only running a single test file.

Coverage results are currently flaky because
src/components/TracePage/index.test.js uses randomly generated trace
data to integration test the page, which sometimes covers code paths in
tableValues.tsx not covered by its own unit tests. Attempt to make
things more stable by extending unit test coverage for tableValues.tsx.

Signed-off-by: Máté Szabó <[email protected]>
@mszabo-wikia mszabo-wikia force-pushed the more-stable-coverage branch from 04c3707 to cbd49dd Compare March 28, 2023 21:57
@@ -209,7 +209,7 @@ function calculateContent(trace: Trace, span: Span, allSpans: Span[], resultValu

tempSelf = onlyOverlay(overlayWithout, allChildrenWithout, tempSelf, span);
const diff = span.relativeStartTime + span.duration - earliestLongerAsParent.relativeStartTime;
tempSelf -= diff;
tempSelf = Math.max(0, tempSelf - diff);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently a bug - the final test case returns a negative value without this guard. The example is somewhat contrived as it hinges on two child spans firing off exactly at trace start time—which is unlikely, but that seems to be the only way to reach line 34.

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

🎉 🙇

@yurishkuro yurishkuro merged commit 7cfe05b into jaegertracing:main Mar 28, 2023
Binrix pushed a commit to Binrix/jaeger-ui that referenced this pull request Apr 18, 2023
## Which problem is this PR solving?
- Makes coverage checks more stable

## Short description of the changes
Coverage results are currently flaky because
src/components/TracePage/index.test.js uses randomly generated trace
data to integration test the page, which sometimes covers code paths in
tableValues.tsx not covered by its own unit tests. Attempt to make
things more stable by extending unit test coverage for tableValues.tsx.

Signed-off-by: Máté Szabó <[email protected]>
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.

2 participants