Skip to content

Commit

Permalink
Merge of #6077
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jul 12, 2024
2 parents 0d7e067 + 8dd5907 commit 25d4b18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ test-network-%:
# Run the tests in the `slasher` crate for all supported database backends.
test-slasher:
cargo nextest run --release -p slasher --features "lmdb,$(TEST_FEATURES)"
cargo nextest run --release -p slasher --no-default-features --features "redb,$(TEST_FEATURES)"
cargo nextest run --release -p slasher --no-default-features --features "mdbx,$(TEST_FEATURES)"
cargo nextest run --release -p slasher --features "lmdb,mdbx,$(TEST_FEATURES)" # both backends enabled
cargo nextest run --release -p slasher --features "lmdb,mdbx,redb,$(TEST_FEATURES)" # all backends enabled

# Runs only the tests/state_transition_vectors tests.
run-state-transition-tests:
Expand Down
2 changes: 1 addition & 1 deletion slasher/src/database/redb_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl Environment {
}

pub fn filenames(&self, config: &Config) -> Vec<PathBuf> {
vec![config.database_path.join(BASE_DB)]
vec![config.database_path.join(REDB_DATA_FILENAME)]
}

pub fn begin_rw_txn(&self) -> Result<RwTransaction, Error> {
Expand Down
20 changes: 2 additions & 18 deletions slasher/tests/backend.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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());
Expand All @@ -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);
}

0 comments on commit 25d4b18

Please sign in to comment.