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

RecentBlogPostsQueryTests.ShouldListBlogPostWhenCallingAQuery is flaky #16018

Closed
Piedone opened this issue May 8, 2024 · 1 comment · Fixed by #16145
Closed

RecentBlogPostsQueryTests.ShouldListBlogPostWhenCallingAQuery is flaky #16018

Piedone opened this issue May 8, 2024 · 1 comment · Fixed by #16145
Labels
bug 🐛 Needs Unit Test(s) Unit Tests or Functional Tests are required
Milestone

Comments

@Piedone
Copy link
Member

Piedone commented May 8, 2024

Describe the bug

The RecentBlogPostsQueryTests.ShouldListBlogPostWhenCallingAQuery test can fail randomly, without the code it tests being wrong, and then succeed on the nest run. I.e., it's flaky.

To Reproduce

I assume that if you run it enough times, eventually, you'll see a random fail. This happened during this build too:

image

A rerun fixed it. I can't reproduce this locally.

I've seen unit tests being flaky before too, but can't recall any specifics. Please add them here if you notice anything else.

Expected behavior

The test only fails if the code is incorrect.

Screenshots

See above.

@Piedone Piedone added bug 🐛 Needs Unit Test(s) Unit Tests or Functional Tests are required labels May 8, 2024
@Piedone Piedone added this to the 2.1 milestone May 8, 2024
@gvkries
Copy link
Contributor

gvkries commented May 23, 2024

I think this can happen if the test is executed very fast (faster the the clock resolution). In that case both blog post may have the same CreatedUtc and ordering becomes random.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Needs Unit Test(s) Unit Tests or Functional Tests are required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants