Fix SQLite tests on Windows (#989)

* Fix sqlite tests on Windows platform

Drop the connection pool so that the database can be persisted.
This commit is contained in:
Sylvain Benner 2023-11-22 09:55:00 -05:00 committed by GitHub
parent be5bb33788
commit 682e7bcbea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -274,9 +274,7 @@ fn create_conn_pool<P: AsRef<Path>>(
OpenFlags::SQLITE_OPEN_READ_ONLY
};
// Create a connection pool and make sure the connections are read only
let manager = SqliteConnectionManager::file(db_file).with_flags(sqlite_flags);
Pool::new(manager).map_err(SqliteDatasetError::ConnectionPool)
}
@ -560,6 +558,13 @@ where
pub fn set_completed(&mut self) -> Result<()> {
let mut is_completed = self.is_completed.write().unwrap();
// Force close the connection pool
// This is required on Windows platform where the connection pool prevents
// from persisting the db by renaming the temp file.
if let Some(pool) = self.conn_pool.take() {
std::mem::drop(pool);
}
// Rename the database file from tmp to db
let _file_result = self
.db_file_tmp