Open pwasiewicz opened 4 years ago
Hi @pwasiewicz, there is no need to Flush
in v5. This automatic execute after insert queue. As your example, you are not sharing MemoryStream across multiples tests (parallel here are using in isolated LiteDatabases and MemoryStream).
I had almost half of my unit tests in LiteDB using MemoryStream too. I will try to reproduce your same example.
@mbdavid I've tried to replace MemoryStream
with :memory:
connection string (just like in your tests here in repo) and problem is gone. Anyway, when switched back to the MemoryStream
- test fails again.
Version 5.0,1
Describe the bug I have bunch of unit tests (1000+). When I write unit test that uses memory stream ( (simplified to show core of code)):
The problem is that sometimes this code fails (tests are running in a parallel). It seems that Query doesn't see inserted record before. (record is null). I can say it is about 50% of cases.
Maybe I am missing some
Flush
after insert?Expected behavior
record
should always be not nullAdditional context Rememeber to run bunch of tests in a parallel.