I've added 2 C# integration tests for an existing SQLite application. Each test creates a database file (using a Guid to guarantee uniqueness) and does a couple of operations on the database. The tests pass in isolation but fail if run one after the other. The second test fails at the point of attempting to create a new SQLiteConnection, with "unable to open database file".
I suspect SQLite's own temporary files are getting in the way. My question in summary is: can I do something to get SQLite to tidy up after itself properly at the end of a test?
Some more details, just in case any of this is relevant:
- I'm using MobileServiceSQLLiteStore
I can see a number of files and folders in %TEMP% after the first test has completed, and before the second test attempts to create its database file:
- File Report20180829-1035.diagsession
- Folder 39fbfdd5-5f6e-4563-9822-cb153e30e5b6.PackageExtraction
- Folder 39FBFDD5-5F6E-4563-9822-CB153E30E5B6.scratch
- Folder E41DD259-1CAA-4FEF-A779-003804F6B783
- Folder E41DD259-1CAA-4FEF-A779-003804F6B783.scratch
- Folder EAFBACB1-B978-419A-98B9-07258EB35C44
Folder EAFBACB1-B978-419A-98B9-07258EB35C44.scratch
- These are all removed at the end of the test apart from 1 and 2 -- and a new Report.39FBFDD5-5F6E-4563-9822-CB153E30E5B6 is left behind. When the test next runs, they're all removed except for 1.