backup/chunk_store.rs: fix test case - use absolute path

This commit is contained in:
Dietmar Maurer 2019-01-25 10:14:25 +01:00
parent 8f973f8181
commit 332dcc2277
1 changed files with 6 additions and 3 deletions

View File

@ -338,12 +338,15 @@ impl ChunkStore {
#[test] #[test]
fn test_chunk_store1() { fn test_chunk_store1() {
let mut path = std::fs::canonicalize(".").unwrap(); // we need absulute path
path.push(".testdir");
if let Err(_e) = std::fs::remove_dir_all(".testdir") { /* ignore */ } if let Err(_e) = std::fs::remove_dir_all(".testdir") { /* ignore */ }
let chunk_store = ChunkStore::open("test", ".testdir"); let chunk_store = ChunkStore::open("test", &path);
assert!(chunk_store.is_err()); assert!(chunk_store.is_err());
let chunk_store = ChunkStore::create("test", ".testdir").unwrap(); let chunk_store = ChunkStore::create("test", &path).unwrap();
let (exists, _) = chunk_store.insert_chunk(&[0u8, 1u8]).unwrap(); let (exists, _) = chunk_store.insert_chunk(&[0u8, 1u8]).unwrap();
assert!(!exists); assert!(!exists);
@ -351,7 +354,7 @@ fn test_chunk_store1() {
assert!(exists); assert!(exists);
let chunk_store = ChunkStore::create("test", ".testdir"); let chunk_store = ChunkStore::create("test", &path);
assert!(chunk_store.is_err()); assert!(chunk_store.is_err());