Skip to content

Commit

Permalink
[Storage] Fix tests. (aptos-labs#6970)
Browse files Browse the repository at this point in the history
  • Loading branch information
grao1991 authored Mar 7, 2023
1 parent 1b1b627 commit eac8511
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion storage/aptosdb/src/pruner/state_store/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ fn verify_state_value_pruner(inputs: Vec<Vec<(StateKey, Option<StateValue>)>>) {

let mut version = 0;
let mut current_state_values = HashMap::new();
let pruner = StateKvPrunerManager::new(Arc::clone(&db.ledger_db), StateKvPrunerConfig {
let pruner = StateKvPrunerManager::new(Arc::clone(&db.state_kv_db), StateKvPrunerConfig {
enable: true,
prune_window: 0,
batch_size: 1,
Expand Down
7 changes: 6 additions & 1 deletion testsuite/smoke-test/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ async fn test_genesis_transaction_flow() {

let db_dir = node.config().storage.dir();
fs::remove_dir_all(&db_dir).unwrap();
db_restore(backup_path.path(), db_dir.as_path(), &[waypoint]);
db_restore(
backup_path.path(),
db_dir.as_path(),
&[waypoint],
node.config().storage.rocksdb_configs.use_state_kv_db,
);

node.start().unwrap();
wait_for_node(node, num_nodes - 2).await;
Expand Down
18 changes: 16 additions & 2 deletions testsuite/smoke-test/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ async fn test_db_restore() {

info!("---------- 3. stopped node 0, gonna restore DB.");
// restore db from backup
db_restore(backup_path.path(), db_dir.as_path(), &[]);
db_restore(
backup_path.path(),
db_dir.as_path(),
&[],
node0_config.storage.rocksdb_configs.use_state_kv_db,
);

expected_balance_0 -= 3;
expected_balance_1 += 3;
Expand Down Expand Up @@ -370,7 +375,12 @@ pub(crate) fn db_backup(
backup_path
}

pub(crate) fn db_restore(backup_path: &Path, db_path: &Path, trusted_waypoints: &[Waypoint]) {
pub(crate) fn db_restore(
backup_path: &Path,
db_path: &Path,
trusted_waypoints: &[Waypoint],
use_state_kv_db: bool,
) {
let now = Instant::now();
let bin_path = workspace_builder::get_bin("aptos-db-tool");
let metadata_cache_path = TempPath::new();
Expand All @@ -384,6 +394,10 @@ pub(crate) fn db_restore(backup_path: &Path, db_path: &Path, trusted_waypoints:
cmd.arg(&w.to_string());
});

if use_state_kv_db {
cmd.arg("--use-state-kv-db");
}

let status = cmd
.args([
"--target-db-dir",
Expand Down

0 comments on commit eac8511

Please sign in to comment.