From 6470429b2b7ba720a3723533625db8f1296a0c7e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 28 Jul 2023 17:54:37 -0400 Subject: [PATCH] tests/destructive: Turn off global sync() Let's verify that things work with that off, as they should. Previously: https://github.com/ostreedev/ostree/pull/2519/commits/cb731294837736e957ee595ce11ab115277dbb36 "deploy: Add a 5s max timeout on global filesystem sync()" But we may still have problems even with that, see https://issues.redhat.com/browse/OCPBUGS-15917 where it might be that even a thread doesn't work because we're locked in the kernel. --- tests/inst/src/destructive.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/inst/src/destructive.rs b/tests/inst/src/destructive.rs index 2cc3a0c2..eb04d68b 100644 --- a/tests/inst/src/destructive.rs +++ b/tests/inst/src/destructive.rs @@ -388,6 +388,17 @@ fn impl_transaction_test>( assert_ne!(commitstates.booted.as_str(), commitstates.target.as_str()); + // Also verify we didn't do a global sync() + { + let out = cmd!( + sh, + "journalctl -u ostree-finalize-staged --grep='Starting global sync'" + ) + .ignore_status() + .read()?; + assert!(!out.contains("Starting global sync")); + } + let rt = tokio::runtime::Runtime::new()?; let cycle_time_ms = (tdata.cycle_time.as_secs_f64() * 1000f64 * FORCE_REBOOT_AFTER_MUL) as u64; // Set when we're trying an interrupt strategy that isn't a reboot, so we will @@ -537,6 +548,18 @@ fn impl_transaction_test>( } } +// See ostree-sysroot.c; we want this off for our tests +fn suppress_ostree_global_sync(sh: &xshell::Shell) -> Result<()> { + let dropindir = "/etc/systemd/system/ostree-finalize-staged.service.d"; + std::fs::create_dir_all(dropindir)?; + std::fs::write( + Path::new(dropindir).join("50-suppress-sync.conf"), + "[Service]\nEnvironment=OSTREE_SYSROOT_OPTS=skip-sync\n", + )?; + cmd!(sh, "systemctl daemon-reload").run()?; + Ok(()) +} + pub(crate) fn itest_transactionality() -> Result<()> { let sh = xshell::Shell::new()?; testinit()?; @@ -582,6 +605,7 @@ pub(crate) fn itest_transactionality() -> Result<()> { // in our reboots, and it currently fails to start. The less // we have in each reboot, the faster reboots are. cmd!(sh, "systemctl disable --now zincati").run()?; + suppress_ostree_global_sync(&sh)?; // And prepare for updates cmd!(sh, "rpm-ostree cleanup -pr").run()?; generate_update(&commit)?;