Fix builds with slasher-redb (#6077)

* Fix builds with slasher-redb feature

* Test redb on CI

* Delete unnecessary test

* Disable redb in slasher override tests
This commit is contained in:
Michael Sproul
2024-07-12 16:13:54 +10:00
committed by GitHub
parent 69d84e785b
commit 7697c127f1
3 changed files with 5 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
#![cfg(any(feature = "lmdb", feature = "redb"))]
#![cfg(feature = "lmdb")]
use slasher::{config::MDBX_DATA_FILENAME, Config, DatabaseBackend, DatabaseBackendOverride};
use std::fs::File;
@@ -41,7 +41,7 @@ fn no_override_with_existing_mdbx_db() {
}
#[test]
#[cfg(all(not(feature = "mdbx"), feature = "lmdb", not(feature = "redb")))]
#[cfg(all(not(feature = "mdbx"), feature = "lmdb"))]
fn failed_override_with_existing_mdbx_db() {
let tempdir = tempdir().unwrap();
let mut config = Config::new(tempdir.path().into());
@@ -55,19 +55,3 @@ fn failed_override_with_existing_mdbx_db() {
);
assert_eq!(config.backend, DatabaseBackend::Lmdb);
}
#[test]
#[cfg(feature = "redb")]
fn failed_override_with_existing_mdbx_db() {
let tempdir = tempdir().unwrap();
let mut config = Config::new(tempdir.path().into());
let filename = config.database_path.join(MDBX_DATA_FILENAME);
File::create(&filename).unwrap();
assert_eq!(
config.override_backend(),
DatabaseBackendOverride::Failure(filename)
);
assert_eq!(config.backend, DatabaseBackend::Redb);
}