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

Increase the margin for the number of threads in RuntimeMetricsWriterTests #5329

Merged
merged 4 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ public async Task ShouldCaptureProcessMetrics()

actualNumberOfThreads.Should().NotBeNull();

// To future generations: if 100 is not enough, feel free to bump it up. We're really just checking that the value is "realistic".
actualNumberOfThreads.Should().NotBeNull().And.BeGreaterThan(0).And.BeInRange(expectedNumberOfThreads - 100, expectedNumberOfThreads + 100);
// A margin of 500 threads seem like a lot, but we have tests that spawn a large number of threads to try to find race conditions
actualNumberOfThreads.Should().NotBeNull().And.BeGreaterThan(0).And.BeInRange(expectedNumberOfThreads - 500, expectedNumberOfThreads + 500);
Copy link
Member

Choose a reason for hiding this comment

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

Is this going to be safer? It feels like we're mostly just checking "is a number" here 😅

Suggested change
actualNumberOfThreads.Should().NotBeNull().And.BeGreaterThan(0).And.BeInRange(expectedNumberOfThreads - 500, expectedNumberOfThreads + 500);
actualNumberOfThreads.Should().NotBeNull().And.BeGreaterThanOrEqualTo(expectedNumberOfThreads );

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"Is a number bigger than 0 and not too crazy" 😛

Copy link
Member

Choose a reason for hiding this comment

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

not too crazy

expectedNumberOfThreads + 500 seems pretty crazy to me 😛


// CPU time and memory usage can vary wildly, so don't try too hard to validate
userCpuTime.Should().NotBeNull().And.BeGreaterThan(0);
Expand Down
Loading