fix tests

This commit is contained in:
Dietmar Maurer 2018-12-19 13:54:22 +01:00
parent 277fc5a3ce
commit f7dd683b46
2 changed files with 8 additions and 5 deletions

View File

@ -16,6 +16,9 @@ DESTDIR=
all: all:
cargo build cargo build
test:
cargo test
.PHONY: deb .PHONY: deb
deb ${DEB}: deb ${DEB}:
rm -rf build rm -rf build

View File

@ -236,7 +236,7 @@ impl ChunkStore {
if metadata.is_file() { if metadata.is_file() {
return Ok((true, digest)); return Ok((true, digest));
} else { } else {
bail!("Got unexpected file type for chunk {}", digest_str); bail!("Got unexpected file type on store '{}' for chunk {}", self.name, digest_str);
} }
} }
@ -252,7 +252,7 @@ impl ChunkStore {
if let Err(err) = std::fs::rename(&tmp_path, &chunk_path) { if let Err(err) = std::fs::rename(&tmp_path, &chunk_path) {
if let Err(_) = std::fs::remove_file(&tmp_path) { /* ignore */ } if let Err(_) = std::fs::remove_file(&tmp_path) { /* ignore */ }
bail!("Atomic rename failed for chunk {} - {}", digest_str, err); bail!("Atomic rename on store '{}' failed for chunk {} - {}", self.name, digest_str, err);
} }
println!("PATH {:?}", chunk_path); println!("PATH {:?}", chunk_path);
@ -281,10 +281,10 @@ fn test_chunk_store1() {
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(".testdir"); let chunk_store = ChunkStore::open("test", ".testdir");
assert!(chunk_store.is_err()); assert!(chunk_store.is_err());
let mut chunk_store = ChunkStore::create(".testdir").unwrap(); let mut chunk_store = ChunkStore::create("test", ".testdir").unwrap();
let (exists, _) = chunk_store.insert_chunk(&[0u8, 1u8]).unwrap(); let (exists, _) = chunk_store.insert_chunk(&[0u8, 1u8]).unwrap();
assert!(!exists); assert!(!exists);
@ -292,7 +292,7 @@ fn test_chunk_store1() {
assert!(exists); assert!(exists);
let chunk_store = ChunkStore::create(".testdir"); let chunk_store = ChunkStore::create("test", ".testdir");
assert!(chunk_store.is_err()); assert!(chunk_store.is_err());