Skip to content

Commit

Permalink
Merge pull request #2893 from cgwalters/update-prow-config
Browse files Browse the repository at this point in the history
ci: Add some composefs testing
  • Loading branch information
jmarrero committed Jun 20, 2023
2 parents ebb9624 + 6df6988 commit f07c93e
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 3 deletions.
21 changes: 19 additions & 2 deletions ci/prow/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
FROM registry.fedoraproject.org/fedora:30
FROM registry.ci.openshift.org/coreos/fcos-buildroot:testing-devel as builder
WORKDIR /src
COPY . .
RUN ./ci/build.sh
RUN env CONFIGOPTS=--with-composefs ./ci/build.sh && make install DESTDIR=/cosa/component-install
RUN make -C tests/kolainst install DESTDIR=/cosa/component-tests
# Uncomment this to fake a build to test the code below
#RUN mkdir -p /cosa/component-install/usr/bin && echo foo > /cosa/component-install/usr/bin/foo

FROM registry.ci.openshift.org/coreos/coreos-assembler:latest
WORKDIR /srv
USER root
# Copy binaries from the build
COPY --from=builder /cosa /cosa
# Merge them to the real root since we're used at compose time
RUN rsync -rlv /cosa/component-install/ /
# Merge installed tests
RUN rsync -rlv /cosa/component-tests/ /
# Grab all of our ci scripts
COPY --from=builder /src/ci/ /ci/
RUN ln -sr /ci/prow/fcos-e2e.sh /usr/bin/fcos-e2e
USER builder
15 changes: 15 additions & 0 deletions ci/prow/fcos-e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -xeuo pipefail

# Prow jobs don't support adding emptydir today
export COSA_SKIP_OVERLAY=1
# And suppress depcheck since we didn't install via RPM
export COSA_SUPPRESS_DEPCHECK=1
ostree --version
cd $(mktemp -d)
cosa init https://github.com/coreos/fedora-coreos-config/
rsync -rlv /cosa/component-install/ overrides/rootfs/
cosa fetch
cosa build
# For now, Prow just runs the composefs tests, since Jenkins covers the others
cosa kola run 'ext.ostree.destructive-rs.composefs*'
31 changes: 31 additions & 0 deletions tests/inst/src/composefs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use anyhow::Result;
use xshell::cmd;

pub(crate) fn itest_composefs() -> Result<()> {
let sh = xshell::Shell::new()?;
if !cmd!(sh, "ostree --version").read()?.contains("- composefs") {
println!("SKIP no composefs support");
return Ok(());
}
let mark = match crate::test::get_reboot_mark()? {
None => {
cmd!(
sh,
"ostree --repo=/ostree/repo config set ex-integrity.composefs true"
)
.run()?;
// A dummy change; TODO add an ostree command for this
cmd!(sh, "rpm-ostree kargs --append=foo=bar").run()?;
return Err(crate::test::reboot("1").into());
}
Some(v) => v,
};
if mark != "1" {
anyhow::bail!("Invalid reboot mark: {mark}")
}

let fstype = cmd!(sh, "findmnt -n -o FSTYPE /").read()?;
assert_eq!(fstype.as_str(), "overlay");

Ok(())
}
6 changes: 5 additions & 1 deletion tests/inst/src/insttestmain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use anyhow::{bail, Result};
use libtest_mimic::Trial;
use structopt::StructOpt;

mod composefs;
mod destructive;
mod repobin;
mod sysroot;
Expand All @@ -28,7 +29,10 @@ const TESTS: &[StaticTest] = &[
test!(repobin::itest_extensions),
test!(repobin::itest_pull_basicauth),
];
const DESTRUCTIVE_TESTS: &[StaticTest] = &[test!(destructive::itest_transactionality)];
const DESTRUCTIVE_TESTS: &[StaticTest] = &[
test!(destructive::itest_transactionality),
test!(composefs::itest_composefs),
];

#[derive(Debug, StructOpt)]
#[structopt(rename_all = "kebab-case")]
Expand Down

0 comments on commit f07c93e

Please sign in to comment.