From 3d1a15bc38def6fa3c0f9bc4ab95c95ccd31cc96 Mon Sep 17 00:00:00 2001 From: wqfish Date: Thu, 30 Apr 2020 00:08:47 -0700 Subject: [PATCH] Use DBPath for backup_restore test and remove _rust_rocksdb* from .gitignore (#419) --- .gitignore | 1 - tests/test_backup.rs | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 936c47d..898817d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ target Cargo.lock *.orig *.bk -_rust_rocksdb* *rlib tags path diff --git a/tests/test_backup.rs b/tests/test_backup.rs index 2e55a5e..572bcd2 100644 --- a/tests/test_backup.rs +++ b/tests/test_backup.rs @@ -16,7 +16,7 @@ mod util; use rocksdb::{ backup::{BackupEngine, BackupEngineOptions, RestoreOptions}, - Options, DB, + DB, }; use util::DBPath; @@ -25,15 +25,13 @@ fn backup_restore() { // create backup let path = DBPath::new("backup_test"); let restore_path = DBPath::new("restore_from_backup_path"); - let mut opts = Options::default(); - opts.create_if_missing(true); { - let db = DB::open(&opts, &path).unwrap(); + let db = DB::open_default(&path).unwrap(); assert!(db.put(b"k1", b"v1111").is_ok()); let value = db.get(b"k1"); assert_eq!(value.unwrap().unwrap(), b"v1111"); { - let backup_path = "_rust_rocksdb_backup_path"; + let backup_path = DBPath::new("backup_path"); let backup_opts = BackupEngineOptions::default(); let mut backup_engine = BackupEngine::open(&backup_opts, &backup_path).unwrap(); assert!(backup_engine.create_new_backup(&db).is_ok());