Merge pull request #2912 from cgwalters/itest-transactionality-debug

tests/inst: A few small patches
This commit is contained in:
Colin Walters 2023-07-05 05:47:05 -04:00 committed by GitHub
commit 25120bd7ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 13 deletions

View File

@ -459,17 +459,14 @@ fn impl_transaction_test<M: AsRef<str>>(
// Reset the target ref to booted, and perform a cleanup
// to ensure we're re-downloading objects each time
let testref = TESTREF;
bash!(
"
systemctl stop rpm-ostreed
systemctl stop ostree-finalize-staged
systemctl stop ostree-finalize-staged-hold
ostree reset testrepo:${testref} ${booted_commit}
rpm-ostree cleanup -pbrm
",
testref,
booted_commit
)
(|| -> Result<()> {
cmd!(sh, "systemctl stop rpm-ostreed").run()?;
cmd!(sh, "systemctl stop ostree-finalize-staged").run()?;
cmd!(sh, "systemctl stop ostree-finalize-staged-hold").run()?;
cmd!(sh, "ostree reset testrepo:{testref} {booted_commit}").run()?;
cmd!(sh, "rpm-ostree cleanup -pbrm").run()?;
Ok(())
})()
.with_context(|| {
format!(
"Failed pre-upgrade cleanup (prev strategy: {})",

View File

@ -26,6 +26,7 @@ const TESTS: &[StaticTest] = &[
test!(sysroot::itest_tmpfiles),
test!(repobin::itest_basic),
test!(repobin::itest_nofifo),
test!(repobin::itest_mtime),
test!(repobin::itest_extensions),
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();
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"#)?;
assert_ne!(ts, Path::new("repo").metadata()?.modified().unwrap());
Ok(())

View File

@ -17,8 +17,6 @@ use hyper::{Body, Request, Response};
use hyper_staticfile::Static;
use tokio::runtime::Runtime;
pub(crate) type TestFn = fn() -> Result<()>;
/// Run command and assert that its stderr contains pat
pub(crate) fn cmd_fails_with<C: BorrowMut<Command>>(mut c: C, pat: &str) -> Result<()> {
let c = c.borrow_mut();