Skip to content

Commit

Permalink
test: add windows mapsize test that should fail
Browse files Browse the repository at this point in the history
WIP: fix this!

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Nov 28, 2024
1 parent c7c6aa4 commit af5b976
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/ndb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,4 +448,35 @@ mod tests {
assert_eq!(note.kind(), 1);
}
}

#[test]
#[cfg(target_os = "windows")]
fn test_windows_large_mapsize() {
use std::{fs, path::Path};

let db = "target/testdbs/event_works";
test_util::cleanup_db(&db);

{
// 32 TiB should be way too big for CI
let config = Config::new().set_mapsize(1024usize * 1024usize * 1024usize * 1024usize * 32usize);
let ndb = Ndb::new(db, &config);
assert!(ndb.is_ok());
}

let file_len = fs::metadata(Path::new(db).join("data.mdb"))
.expect("metadata")
.len();

assert!(file_len > 0);

if cfg!(target_os = "windows") {
assert_ne!(file_len, 1048576);
} else {
assert!(file_len < 1024u64 * 1024u64);
}

// If the file size is the default mapsize on windows, this is a bug!

}
}

0 comments on commit af5b976

Please sign in to comment.