Repository: mintlayer/mintlayer-core
Pull request #672 (2023-02-03 18:57:04)

Remove more unused error variants
I found more unused errors during my p2p error handling refactoring (which I decided to drop by the way). Perhaps we will need some of these errors in the future, but I prefer to add a new entity when it is needed and not to dial whit the dead code.


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 3c78c13f4..9907f4b0e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -66,17 +66,6 @@ dependencies = [
  "subtle",
 ]
 
-[[package]]
-name = "ahash"
-version = "0.7.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
-dependencies = [
- "getrandom",
- "once_cell",
- "version_check",
-]
-
 [[package]]
 name = "aho-corasick"
 version = "0.7.20"
@@ -956,12 +945,6 @@ version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
 
-[[package]]
-name = "fallible-streaming-iterator"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
-
 [[package]]
 name = "fastrand"
 version = "1.8.0"
@@ -1271,18 +1254,6 @@ name = "hashbrown"
 version = "0.12.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
-dependencies = [
- "ahash",
-]
-
-[[package]]
-name = "hashlink"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa"
-dependencies = [
- "hashbrown",
-]
 
 [[package]]
 name = "heck"
@@ -1680,17 +1651,6 @@ version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
 
-[[package]]
-name = "libsqlite3-sys"
-version = "0.25.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29f835d03d717946d28b1d1ed632eb6f0e24a299388ee623d0c23118d3e8a7fa"
-dependencies = [
- "cc",
- "pkg-config",
- "vcpkg",
-]
-
 [[package]]
 name = "libtest-mimic"
 version = "0.6.0"
@@ -2730,20 +2690,6 @@ dependencies = [
  "unicode-ident",
 ]
 
-[[package]]
-name = "rusqlite"
-version = "0.28.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01e213bc3ecb39ac32e81e51ebe31fd888a940515173e3a18a35f8c6e896422a"
-dependencies = [
- "bitflags",
- "fallible-iterator",
- "fallible-streaming-iterator",
- "hashlink",
- "libsqlite3-sys",
- "smallvec",
-]
-
 [[package]]
 name = "rustc-hash"
 version = "1.1.0"
@@ -3362,18 +3308,6 @@ dependencies = [
  "utils",
 ]
 
-[[package]]
-name = "storage-sqlite"
-version = "0.1.0"
-dependencies = [
- "logging",
- "rusqlite",
- "storage-backend-test-suite",
- "storage-core",
- "test-utils",
- "utils",
-]
-
 [[package]]
 name = "strsim"
 version = "0.10.0"
@@ -3825,12 +3759,6 @@ version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
 
-[[package]]
-name = "vcpkg"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
-
 [[package]]
 name = "version_check"
 version = "0.9.4"
diff --git a/Cargo.toml b/Cargo.toml
index 179f91322..4310be080 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,7 +35,6 @@ members = [
   "storage/core",                 # Core backend-agnostic storage abstraction.
   "storage/inmemory",             # In-memory storage backend implementation.
   "storage/lmdb",                 # LMDB-based persistent storage backend implementation.
-  "storage/sqlite",               # SQLite-based persistent storage backend implementation.
   "subsystem",                    # Utilities for working with concurrent subsystems.
   "test",                         # Integration tests.
   "test-utils",                   # Various utilities for tests.
diff --git a/p2p/src/error.rs b/p2p/src/error.rs
index 4534dc468..e6a5faca5 100644
--- a/p2p/src/error.rs
+++ b/p2p/src/error.rs
@@ -36,16 +36,12 @@ pub enum ProtocolError {
 pub enum PeerError {
     #[error("Peer disconnected")]
     PeerDisconnected,
-    #[error("No peers")]
-    NoPeers,
     #[error("Peer doesn't exist")]
     PeerDoesntExist,
     #[error("Peer already exists")]
     PeerAlreadyExists,
     #[error("Address {0} is banned")]
     BannedAddress(String),
-    #[error("Peer {0} is banned")]
-    BannedPeer(String),
     #[error("PeerManager has too many peers")]
     TooManyPeers,
     #[error("Connection to address {0} already pending")]
@@ -55,33 +51,17 @@ pub enum PeerError {
 /// PubSub errors for announcements
 #[derive(Error, Debug, PartialEq, Eq)]
 pub enum PublishError {
-    #[error("Failed to sign message")]
-    SigningFailed,
     #[error("Message is too large. Tried to send {0:?} bytes when limit is {1:?}")]
     MessageTooLarge(usize, usize),
-    #[error("Failed to compress the message")]
-    TransformFailed,
 }
 
 /// Errors related to establishing a connection with a remote peer
 #[derive(Error, Debug, PartialEq, Eq)]
 pub enum DialError {
-    #[error("Peer is banned")]
-    Banned,
-    #[error("Limit for outgoing connections reached: {0}")]
-    ConnectionLimit(usize),
     #[error("Tried to dial self")]
     AttemptToDialSelf,
     #[error("Peer doesn't have any known addresses")]
     NoAddresses,
-    #[error("Peer state not correct for dialing")]
-    DialPeerConditionFalse,
-    #[error("Connection has been aborted")]
-    Aborted,
-    #[error("Invalid PeerId")]
-    InvalidPeerId,
-    #[error("PeerId doesn't match the PeerId of endpoint")]
-    WrongPeerId,
     #[error("Connection refused or timed out")]
     ConnectionRefusedOrTimedOut,
     #[error("I/O error: `{0:?}`")]
@@ -194,9 +174,7 @@ impl BanScore for ProtocolError {
 impl BanScore for PublishError {
     fn ban_score(&self) -> u32 {
         match self {
-            PublishError::SigningFailed => 0,
             PublishError::MessageTooLarge(_, _) => 100,
-            PublishError::TransformFailed => 0,
         }
     }
 }
diff --git a/storage/sqlite/Cargo.toml b/storage/sqlite/Cargo.toml
deleted file mode 100644
index dbc711267..000000000
--- a/storage/sqlite/Cargo.toml
+++ /dev/null
@@ -1,20 +0,0 @@
-[package]
-name = "storage-sqlite"
-version = "0.1.0"
-edition = "2021"
-license = "MIT"
-
-[dependencies]
-logging = { path = '../../logging' }
-storage-core = { path = '../core' }
-utils = { path = '../../utils' }
-
-rusqlite = { version = "0.28", features = ["bundled"] }
-
-[dev-dependencies]
-storage-backend-test-suite = { path = "../backend-test-suite" }
-test-utils = { path = "../../test-utils" }
-
-[[test]]
-name = "backend"
-harness = false
diff --git a/storage/sqlite/src/error.rs b/storage/sqlite/src/error.rs
deleted file mode 100644
index 5f2d3804a..000000000
--- a/storage/sqlite/src/error.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2022 RBB S.r.l
-// opensource@mintlayer.org
-// SPDX-License-Identifier: MIT
-// Licensed under the MIT License;
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://github.com/mintlayer/mintlayer-core/blob/master/LICENSE
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-use rusqlite::Error as SqlError;
-use std::io::{Error as IoError, ErrorKind};
-
-use storage_core::error::{Fatal, Recoverable};
-
-/// Map IoError into a storage error
-pub fn process_io_error(err: IoError) -> storage_core::Error {
-    match err.kind() {
-        ErrorKind::BrokenPipe
-        | ErrorKind::AlreadyExists
-        | ErrorKind::PermissionDenied
-        | ErrorKind::NotFound => Recoverable::Io(err.kind(), err.to_string()).into(),
-        _ => Fatal::Io(err.kind(), err.to_string()).into(),
-    }
-}
-
-/// Map Sqlite error into a storage error
-pub fn process_sqlite_error(err: rusqlite::Error) -> storage_core::Error {
-    // TODO Improve error conversions
-    match err {
-        SqlError::SqliteFailure(err, err_str) => {
-            Fatal::InternalError(err_str.unwrap_or_else(|| err.to_string())).into()
-        }
-        _ => Fatal::InternalError(err.to_string()).into(),
-    }
-}
diff --git a/storage/sqlite/src/lib.rs b/storage/sqlite/src/lib.rs
deleted file mode 100644
index cfdc6e9ac..000000000
--- a/storage/sqlite/src/lib.rs
+++ /dev/null
@@ -1,310 +0,0 @@
-// Copyright (c) 2023 RBB S.r.l
-// opensource@mintlayer.org
-// SPDX-License-Identifier: MIT
-// Licensed under the MIT License;
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://github.com/mintlayer/mintlayer-core/blob/master/LICENSE
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-extern crate core;
-
-mod error;
-mod queries;
-
-use rusqlite::{Connection, OpenFlags, OptionalExtension};
-use std::borrow::Cow;
-use std::cmp::max;
-use std::path::PathBuf;
-use std::sync::{Mutex, MutexGuard};
-
-use crate::queries::SqliteQueries;
-use error::process_sqlite_error;
-use storage_core::{
-    backend::{self, TransactionalRo, TransactionalRw},
-    info::DbDesc,
-    Data, DbIndex,
-};
-use utils::shallow_clone::ShallowClone;
-use utils::sync::Arc;
-
-/// Sqlite iterator over entries with given key prefix
-pub struct PrefixIter {
-    /// Underlying iterator
-    iter: std::vec::IntoIter<(Vec<u8>, Vec<u8>)>,
-
-    /// Prefix to iterate over
-    prefix: Data,
-}
-
-impl PrefixIter {
-    fn new(iter: std::vec::IntoIter<(Vec<u8>, Vec<u8>)>, prefix: Data) -> Self {
-        PrefixIter { iter, prefix }
-    }
-}
-
-impl Iterator for PrefixIter {
-    type Item = (Data, Data);
-
-    fn next(&mut self) -> Option<Self::Item> {
-        let kv = self.iter.next()?;
-        utils::ensure!(kv.0.starts_with(&self.prefix));
-        Some(kv)
-    }
-}
-
-pub struct DbTx<'m> {
-    connection: MutexGuard<'m, Connection>,
-    queries: &'m SqliteQueries,
-}
-
-impl<'m> DbTx<'m> {
-    fn start_transaction(sqlite: &'m SqliteImpl) -> storage_core::Result<Self> {
-        let connection = sqlite
-            .0
-            .connection
-            .lock()
-            .map_err(|e| storage_core::error::Fatal::InternalError(e.to_string()))?;
-        let tx = DbTx {
-            connection,
-            queries: &sqlite.0.queries,
-        };
-        tx.connection.execute("BEGIN TRANSACTION", ()).map_err(process_sqlite_error)?;
-        Ok(tx)
-    }
-
-    fn commit_transaction(&self) -> storage_core::Result<()> {
-        let _res = self
-            .connection
-            .execute("COMMIT TRANSACTION", ())
-            .map_err(process_sqlite_error)?;
-        Ok(())
-    }
-}
-
-impl Drop for DbTx<'_> {
-    fn drop(&mut self) {
-        if self.connection.is_autocommit() {
-            return;
-        }
-
-        let res = self.connection.execute("ROLLBACK TRANSACTION", ());
-        if let Err(err) = res {
-            logging::log::error!("Error: transaction rollback failed: {}", err);
-        }
-    }
-}
-
-impl<'s, 'i> backend::PrefixIter<'i> for DbTx<'s> {
-    type Iterator = PrefixIter;
-
-    fn prefix_iter<'t: 'i>(
-        &'t self,
-        idx: DbIndex,
-        prefix: Data,
-    ) -> storage_core::Result<Self::Iterator> {
-        // TODO check if prefix.is_empty()
-        // TODO Perform the filtering in the SQL query itself
-        let mut stmt = self
-            .connection
-            .prepare_cached(self.queries[idx].prefix_iter_query.as_str())
-            .map_err(process_sqlite_error)?;
-
-        let mut rows = stmt.query(()).map_err(process_sqlite_error)?;
-
-        // TODO Move the statement/rows in to the PrefixIter
-        let mut kv = Vec::new();
-        while let Some(row) = rows.next().map_err(process_sqlite_error)? {
-            let key = row.get::<usize, Vec<u8>>(0).map_err(process_sqlite_error)?;
-            if key.starts_with(&prefix) {
-                let value = row.get::<usize, Vec<u8>>(1).map_err(process_sqlite_error)?;
-                kv.push((key, value));
-            }
-        }
-        let kv_iter = kv.into_iter();
-
-        Ok(PrefixIter::new(kv_iter, prefix))
-    }
-}
-
-impl backend::ReadOps for DbTx<'_> {
-    fn get(&self, idx: DbIndex, key: &[u8]) -> storage_core::Result<Option<Cow<[u8]>>> {
-        let mut stmt = self
-            .connection
-            .prepare_cached(self.queries[idx].get_query.as_str())
-            .map_err(process_sqlite_error)?;
-
-        let params = (key,);
-        let res = stmt
-            .query_row(params, |row| row.get::<usize, Vec<u8>>(0))
-            .optional()
-            .map_err(process_sqlite_error)?;
-        let res = res.map(|v| v.into());
-        Ok(res)
-    }
-}
-
-impl backend::WriteOps for DbTx<'_> {
-    fn put(&mut self, idx: DbIndex, key: Data, val: Data) -> storage_core::Result<()> {
-        let mut stmt = self
-            .connection
-            .prepare_cached(self.queries[idx].put_query.as_str())
-            .map_err(process_sqlite_error)?;
-
-        let params = (key, val);
-        let _res = stmt.execute(params).map_err(process_sqlite_error)?;
-
-        Ok(())
-    }
-
-    fn del(&mut self, idx: DbIndex, key: &[u8]) -> storage_core::Result<()> {
-        let mut stmt = self
-            .connection
-            .prepare_cached(self.queries[idx].delete_query.as_str())
-            .map_err(process_sqlite_error)?;
-
-        let params = (key,);
-        let _res = stmt.execute(params).map_err(process_sqlite_error)?;
-
-        Ok(())
-    }
-}
-
-impl backend::TxRo for DbTx<'_> {}
-
-impl backend::TxRw for DbTx<'_> {
-    fn commit(self) -> storage_core::Result<()> {
-        self.commit_transaction()
-    }
-}
-
-/// Struct that holds the details for an Sqlite connection
-pub struct SqliteConnection {
-    /// Handle to an Sqlite database connection
-    connection: Mutex<Connection>,
-
-    /// List of sql queries
-    queries: SqliteQueries,
-}
-
-#[derive(Clone)]
-pub struct SqliteImpl(Arc<SqliteConnection>);
-
-impl SqliteImpl {
-    /// Start a transaction using the low-level method provided
-    fn start_transaction(&self) -> storage_core::Result<DbTx<'_>> {
-        DbTx::start_transaction(self)
-    }
-}
-
-impl<'tx> TransactionalRo<'tx> for SqliteImpl {
-    type TxRo = DbTx<'tx>;
-
-    fn transaction_ro<'st: 'tx>(&'st self) -> storage_core::Result<Self::TxRo> {
-        self.start_transaction()
-    }
-}
-
-impl<'tx> TransactionalRw<'tx> for SqliteImpl {
-    type TxRw = DbTx<'tx>;
-
-    fn transaction_rw<'st: 'tx>(
-        &'st self,
-        _size: Option<usize>,
-    ) -> storage_core::Result<Self::TxRw> {
-        self.start_transaction()
-    }
-}
-
-impl ShallowClone for SqliteImpl {}
-
-impl backend::BackendImpl for SqliteImpl {}
-
-#[derive(Eq, PartialEq, Clone, Debug)]
-pub struct Sqlite {
-    path: PathBuf,
-}
-
-impl Sqlite {
-    /// New Sqlite database backend
-    pub fn new(path: PathBuf) -> Self {
-        Self { path }
-    }
-
-    // fn open_db(self, desc: &MapDesc) -> storage_core::Result<Connection> {
-    fn open_db(self, desc: DbDesc) -> rusqlite::Result<Connection> {
-        let flags = OpenFlags::from_iter([
-            OpenFlags::SQLITE_OPEN_FULL_MUTEX,
-            OpenFlags::SQLITE_OPEN_READ_WRITE,
-            OpenFlags::SQLITE_OPEN_CREATE,
-        ]);
-
-        let connection = Connection::open_with_flags(self.path, flags)?;
-
-        // Set the locking mode to exclusive
-        connection.pragma_update(None, "locking_mode", "exclusive")?;
-
-        // Begin a transaction to acquire the exclusive lock
-        connection.execute("BEGIN EXCLUSIVE TRANSACTION", ())?;
-        connection.execute("COMMIT", ())?;
-
-        // Enable fullfsync
-        connection.pragma_update(None, "fullfsync", "true")?;
-
-        // Create a table check sql statement
-        let mut exists_stmt = connection
-            .prepare_cached("SELECT name FROM sqlite_master WHERE type='table' AND name=?")?;
-
-        // Check if the required tables exist and if needed create them
-        for idx in 0..desc.len() {
-            let table_name = queries::db_table_name(idx);
-            // Check if table is missing
-            let is_missing = exists_stmt
-                .query_row([&table_name], |row| row.get::<usize, String>(0))
-                .optional()?
-                .is_none();
-            // Create the table if needed
-            if is_missing {
-                connection.execute(queries::create_table_query(&table_name).as_str(), ())?;
-            }
-        }
-        drop(exists_stmt);
-
-        // Set statement cache to fit all the prepared statements we use
-        connection.set_prepared_statement_cache_capacity(max(desc.len() * 4, 16));
-
-        Ok(connection)
-    }
-}
-
-impl backend::Backend for Sqlite {
-    type Impl = SqliteImpl;
-
-    fn open(self, desc: DbDesc) -> storage_core::Result<Self::Impl> {
-        // Attempt to create the parent storage directory
-        if let Some(parent) = self.path.parent() {
-            std::fs::create_dir_all(parent).map_err(error::process_io_error)?;
-        } else {
-            return Err(storage_core::error::Recoverable::Io(
-                std::io::ErrorKind::NotFound,
-                "Cannot find the parent directory".to_string(),
-            )
-            .into());
-        }
-
-        let queries = SqliteQueries::new(&desc);
-
-        let connection = self.open_db(desc).map_err(process_sqlite_error)?;
-
-        Ok(SqliteImpl(Arc::new(SqliteConnection {
-            connection: Mutex::new(connection),
-            queries,
-        })))
-    }
-}
diff --git a/storage/sqlite/src/queries.rs b/storage/sqlite/src/queries.rs
deleted file mode 100644
index 74be58b65..000000000
--- a/storage/sqlite/src/queries.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2023 RBB S.r.l
-// opensource@mintlayer.org
-// SPDX-License-Identifier: MIT
-// Licensed under the MIT License;
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://github.com/mintlayer/mintlayer-core/blob/master/LICENSE
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-use storage_core::{DbDesc, DbIndex};
-
-/// Return the prefix of the database key/value tables
-#[inline]
-pub fn db_table_name(idx: usize) -> String {
-    format!("db_{idx}")
-}
-
-/// Returns an SQL query to create a table
-#[inline]
-pub fn create_table_query(table_name: &String) -> String {
-    format!("CREATE TABLE {table_name}(key BLOB PRIMARY KEY NOT NULL, value BLOB NOT NULL)")
-}
-
-/// SQL queries that are customized per an individual key/value database
-#[derive(Eq, PartialEq, Debug, Clone)]
-pub struct SqliteQuery {
-    /// Used for the get operation
-    pub get_query: String,
-    /// Used for the prefix iter operation
-    pub prefix_iter_query: String,
-    /// Used for the put operation
-    pub put_query: String,
-    /// Used for the delete operation
-    pub delete_query: String,
-}
-
-/// Holds typical SQL queries like for retrieving, inserting, deleting key/values
-#[derive(Eq, PartialEq, Debug, Clone)]
-pub struct SqliteQueries(Vec<SqliteQuery>);
-
-impl SqliteQueries {
-    pub fn new(desc: &DbDesc) -> Self {
-        // Set up all the databases
-        let queries = (0..desc.len())
-            .map(|i| SqliteQuery {
-                get_query: format!("SELECT value FROM db_{i} WHERE key = ?"),
-                prefix_iter_query: format!("SELECT key, value FROM db_{i} ORDER BY key"),
-                put_query: format!("INSERT or REPLACE into db_{i} values(?, ?)"),
-                delete_query: format!("DELETE FROM db_{i} WHERE key = ?"),
-            })
-            .collect();
-
-        Self(queries)
-    }
-}
-
-impl std::ops::Index<DbIndex> for SqliteQueries {
-    type Output = SqliteQuery;
-
-    fn index(&self, index: DbIndex) -> &Self::Output {
-        &self.0[index.get()]
-    }
-}


Test patch:
diff --git a/storage/sqlite/tests/backend.rs b/storage/sqlite/tests/backend.rs
deleted file mode 100644
index 4ec661c46..000000000
--- a/storage/sqlite/tests/backend.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2022 RBB S.r.l
-// opensource@mintlayer.org
-// SPDX-License-Identifier: MIT
-// Licensed under the MIT License;
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://github.com/mintlayer/mintlayer-core/blob/master/LICENSE
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-use storage_sqlite::Sqlite;
-
-fn main() {
-    let test_root = test_utils::test_root!("backend-tests").unwrap();
-
-    // Backend creation procedure
-    let create_backend = {
-        let test_root = test_root.clone();
-        move || {
-            // Each test case gets its own subdirectory to avoid clashes
-            let db_file_path = test_root
-                .fresh_test_dir("unknown")
-                .as_ref()
-                .to_path_buf()
-                .join("database.sqlite");
-            Sqlite::new(db_file_path)
-        }
-    };
-
-    // Now run the tests
-    let result = storage_backend_test_suite::main(create_backend);
-
-    // Remove the test directory unless there was a failure.
-    // In case of failure, it is kept to give us the opportunity to inspect database contents.
-    if !result.has_failed() {
-        test_root.delete();
-    }
-
-    result.exit()
-}