Skip to content

Commit

Permalink
Merge pull request #196 from newrelic/fix-test-flicker
Browse files Browse the repository at this point in the history
Fix ThreadStateSamplerTest flicker
  • Loading branch information
jasonjkeller authored Jan 26, 2021
2 parents 0d8d810 + b0e956f commit 5c9f82a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ public void testCpuTimeMetrics() {
cpuCalculationTimeSeconds >= totalTimeSeconds);
assertTrue("UserTime: " + userTimeSeconds + ", SystemTime: " + systemTimeSeconds,
userTimeSeconds > systemTimeSeconds);
// This test is prone to flickering due to high load scenarios and rounding errors, hence the modifier added to totalTimeSeconds
assertTrue("TotalTime: " + totalTimeSeconds + ", SystemTime: " + systemTimeSeconds + ", UserTime: " + userTimeSeconds,
totalTimeSeconds + 0.2 >= systemTimeSeconds + userTimeSeconds); // account for rounding error
totalTimeSeconds + 4.0 >= systemTimeSeconds + userTimeSeconds); // account for rounding error

// Since we can't guarantee the exact total time, it should be
// between 1 and 5 (since we had a busywork loop for ~5000ms)
Expand Down

0 comments on commit 5c9f82a

Please sign in to comment.