tests: Enable mtime test

I think this just accidentally was never enabled.

While looking at the code, add a sleep here to be resilient to
filesystems with only second mtime granularity.
This commit is contained in:
Colin Walters 2023-06-29 02:11:09 -04:00
parent 0b519c2573
commit 8bba482bc8
2 changed files with 2 additions and 0 deletions

View File

@ -26,6 +26,7 @@ const TESTS: &[StaticTest] = &[
test!(sysroot::itest_tmpfiles), test!(sysroot::itest_tmpfiles),
test!(repobin::itest_basic), test!(repobin::itest_basic),
test!(repobin::itest_nofifo), test!(repobin::itest_nofifo),
test!(repobin::itest_mtime),
test!(repobin::itest_extensions), test!(repobin::itest_extensions),
test!(repobin::itest_pull_basicauth), test!(repobin::itest_pull_basicauth),
]; ];

View File

@ -42,6 +42,7 @@ pub(crate) fn itest_mtime() -> Result<()> {
" "
)?; )?;
let ts = Path::new("repo").metadata()?.modified().unwrap(); let ts = Path::new("repo").metadata()?.modified().unwrap();
std::thread::sleep(std::time::Duration::from_secs(1));
bash!(r#"ostree --repo=repo commit -b test -s "bump mtime" --tree=dir=tmproot >/dev/null"#)?; bash!(r#"ostree --repo=repo commit -b test -s "bump mtime" --tree=dir=tmproot >/dev/null"#)?;
assert_ne!(ts, Path::new("repo").metadata()?.modified().unwrap()); assert_ne!(ts, Path::new("repo").metadata()?.modified().unwrap());
Ok(()) Ok(())