From bcc0ef7583508a857c6ed32a2cec3e20c2a2bd23 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 30 Sep 2021 13:38:25 -0400 Subject: tests: Use ostree-ext 0.3.0 This updates to the modern glib 0.14 and paves the way for some reverse dependency testing by using ostree-ext's code. --- tests/inst/Cargo.toml | 4 +--- tests/inst/src/destructive.rs | 12 +++++++----- tests/inst/src/sysroot.rs | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml index bac4e42d..146744b8 100644 --- a/tests/inst/Cargo.toml +++ b/tests/inst/Cargo.toml @@ -17,9 +17,7 @@ serde_json = "1.0" sh-inline = "0.1.0" anyhow = "1.0" tempfile = "3.1.0" -glib = "0.10" -gio = "0.9" -ostree = { version = "0.10.0", features = ["v2021_1"] } +ostree-ext = { version = "0.3.0" } libtest-mimic = "0.3.0" twoway = "0.2.1" hyper = { version = "0.14", features = ["runtime", "http1", "http2", "tcp", "server"] } diff --git a/tests/inst/src/destructive.rs b/tests/inst/src/destructive.rs index 5f4fb790..2e2bd374 100644 --- a/tests/inst/src/destructive.rs +++ b/tests/inst/src/destructive.rs @@ -20,6 +20,8 @@ //! AUTOPKGTEST_REBOOT_MARK. use anyhow::{Context, Result}; +use ostree_ext::gio; +use ostree_ext::ostree; use rand::seq::SliceRandom; use rand::Rng; use serde::{Deserialize, Serialize}; @@ -283,7 +285,7 @@ fn parse_and_validate_reboot_mark>( // Since we successfully updated, generate a new commit to target generate_update(&firstdeploy.checksum)?; // Update the target state - let srvrepo_obj = ostree::Repo::new(&gio::File::new_for_path(SRVREPO)); + let srvrepo_obj = ostree::Repo::new(&gio::File::for_path(SRVREPO)); srvrepo_obj.open(gio::NONE_CANCELLABLE)?; commitstates.target = srvrepo_obj.resolve_rev(TESTREF, false)?.unwrap().into(); } else if commitstates.booted == commitstates.orig || commitstates.booted == commitstates.prev { @@ -352,9 +354,9 @@ fn impl_transaction_test>( // Gather the expected possible commits let mut commitstates = { - let srvrepo_obj = ostree::Repo::new(&gio::File::new_for_path(SRVREPO)); + let srvrepo_obj = ostree::Repo::new(&gio::File::for_path(SRVREPO)); srvrepo_obj.open(gio::NONE_CANCELLABLE)?; - let sysrepo_obj = ostree::Repo::new(&gio::File::new_for_path("/sysroot/ostree/repo")); + let sysrepo_obj = ostree::Repo::new(&gio::File::for_path("/sysroot/ostree/repo")); sysrepo_obj.open(gio::NONE_CANCELLABLE)?; CommitStates { @@ -543,8 +545,8 @@ fn transactionality() -> Result<()> { let sysroot = ostree::Sysroot::new_default(); sysroot.load(cancellable.as_ref())?; assert!(sysroot.is_booted()); - let booted = sysroot.get_booted_deployment().expect("booted deployment"); - let commit: String = booted.get_csum().expect("booted csum").into(); + let booted = sysroot.booted_deployment().expect("booted deployment"); + let commit: String = booted.csum().expect("booted csum").into(); // We need this static across reboots let srvrepo = Path::new(SRVREPO); let firstrun = !srvrepo.exists(); diff --git a/tests/inst/src/sysroot.rs b/tests/inst/src/sysroot.rs index ce0378eb..301ef8b3 100644 --- a/tests/inst/src/sysroot.rs +++ b/tests/inst/src/sysroot.rs @@ -1,8 +1,8 @@ //! Tests that mostly use the API and access the booted sysroot read-only. use anyhow::Result; -use gio::prelude::*; -use ostree::prelude::*; +use ostree_ext::prelude::*; +use ostree_ext::{gio, ostree}; use crate::test::*; @@ -21,11 +21,11 @@ fn test_sysroot_ro() -> Result<()> { sysroot.load(cancellable.as_ref())?; assert!(sysroot.is_booted()); - let booted = sysroot.get_booted_deployment().expect("booted deployment"); + let booted = sysroot.booted_deployment().expect("booted deployment"); assert!(!booted.is_staged()); let repo = sysroot.repo().expect("repo"); - let csum = booted.get_csum().expect("booted csum"); + let csum = booted.csum().expect("booted csum"); let csum = csum.as_str(); let (root, rev) = repo.read_commit(csum, cancellable.as_ref())?; -- cgit v1.2.1