-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Fix module init issue with Verify #2092
Conversation
Looks like the same thing is happening for
|
I was able to do a small repro project that fails every time: https://github.com/mattjohnsonpint/repro-verify-http-issue But interestingly, it also gives CA2255 warning on the initializer in the base class. Not sure why we don't get one in
Thus the real problem here isn't Verify, but that we're initializing parts of verify in the base libraries rather in that the end test project. I'll make an update to resolve that. |
New approach:
Net result should be only the final test projects use module initializers - referenced projects won't have any. |
We've started getting intermittent issues such as the following. Run the same test repeatedly and it fails about half the time and passes about half the time.
After some investigation, I believe this is due to a recently added Verify feature: VerifyTests/Verify#745.
It would seem that this fails in the case of test project referencing another test project. In our case, the
Sentry.AspNetCore.Tests
project is referenced by three others. Since the order tests run is nondeterministic, if a test that uses the parent project runs first, then the parent project's module init is called before any verify tests and everything is fine. But if one of the child project's verify tests that doesn't use the parent project is run first (such as theApiApprovalTests
), then the module init of the parent project runs too late and throws the error.@SimonCropp - this should probably be addressed in Verify itself.
As a workaround, we can just make sure each child project has its own module init that uses something from the parent project - which gets the parent project's module init to run immediately.
#skip-changelog