Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed May 31, 2024
1 parent f152bfe commit 0a7a7eb
Show file tree
Hide file tree
Showing 15 changed files with 174 additions and 369 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ jobs:
run: mkdir -p target/man && cargo run --features=docgen -- man --directory target/man
- name: Clippy (gate on correctness and suspicous)
run: cargo clippy -- -D clippy::correctness -D clippy::suspicious
integration-test-binary:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'control/skip-ci') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Mark git checkout as safe
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
# xref containers/containers-image-proxy-rs
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
with:
key: "testbinary"
- name: Build
run: cargo b --release -p tests-integration
fedora-container-tests:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'control/skip-ci') }}
runs-on: ubuntu-24.04
Expand All @@ -57,9 +71,7 @@ jobs:
- name: Build container (fedora)
run: sudo podman build --build-arg=base=quay.io/fedora/fedora-bootc:40 -t localhost/bootc -f hack/Containerfile .
- name: Container integration
run: sudo podman run --rm localhost/bootc bootc internal-tests run-container-integration
- name: Privileged tests
run: sudo podman run --rm --privileged -v /run/systemd:/run/systemd -v /:/run/host --pid=host localhost/bootc bootc internal-tests run-privileged-integration
run: sudo podman run --rm localhost/bootc bootc-integration-tests container
cargo-deny:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ prefix ?= /usr
all:
cargo build --release

all-test:
cargo build --release --all-features

install:
install -D -m 0755 -t $(DESTDIR)$(prefix)/bin target/release/bootc
install -d -m 0755 $(DESTDIR)$(prefix)/lib/systemd/system-generators/
Expand All @@ -22,11 +19,14 @@ install:
done
install -D -m 0644 -t $(DESTDIR)/$(prefix)/lib/systemd/system systemd/*.service systemd/*.timer

install-with-tests: install
install -D -m 0755 target/release/tests-integration $(DESTDIR)$(prefix)/bin/bootc-integration-tests

bin-archive: all
$(MAKE) install DESTDIR=tmp-install && tar --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf

test-bin-archive: all-test
$(MAKE) install DESTDIR=tmp-install && tar --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
test-bin-archive: all
$(MAKE) install-with-tests DESTDIR=tmp-install && tar --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf

install-kola-tests:
install -D -t $(DESTDIR)$(prefix)/lib/coreos-assembler/tests/kola/bootc tests/kolainst/*
Expand Down
3 changes: 1 addition & 2 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,4 @@ default = ["install"]
install = []
# Implementation detail of man page generation.
docgen = ["clap_mangen"]
# This feature should only be enabled in CI environments.
internal-testing-api = ["xshell"]

28 changes: 0 additions & 28 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,28 +161,6 @@ impl InternalsOpts {
const GENERATOR_BIN: &'static str = "bootc-systemd-generator";
}

/// Options for internal testing
#[derive(Debug, clap::Subcommand, PartialEq, Eq)]
pub(crate) enum TestingOpts {
/// Execute integration tests that require a privileged container
RunPrivilegedIntegration {},
/// Execute integration tests that target a not-privileged ostree container
RunContainerIntegration {},
/// Block device setup for testing
PrepTestInstallFilesystem { blockdev: Utf8PathBuf },
/// e2e test of install to-filesystem
TestInstallFilesystem {
image: String,
blockdev: Utf8PathBuf,
},
#[clap(name = "verify-selinux")]
VerifySELinux {
root: String,
#[clap(long)]
warn: bool,
},
}

/// Deploy and transactionally in-place with bootable container images.
///
/// The `bootc` project currently uses ostree-containers as a backend
Expand Down Expand Up @@ -302,10 +280,6 @@ pub(crate) enum Opt {
#[clap(subcommand)]
#[clap(hide = true)]
Internals(InternalsOpts),
/// Internal integration testing helpers.
#[clap(hide(true), subcommand)]
#[cfg(feature = "internal-testing-api")]
InternalTests(TestingOpts),
#[clap(hide(true))]
#[cfg(feature = "docgen")]
Man(ManOpts),
Expand Down Expand Up @@ -689,8 +663,6 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
}
InternalsOpts::FixupEtcFstab => crate::deploy::fixup_etc_fstab(&root),
},
#[cfg(feature = "internal-testing-api")]
Opt::InternalTests(opts) => crate::privtests::run(opts).await,
#[cfg(feature = "docgen")]
Opt::Man(manopts) => crate::docgen::generate_manpages(&manopts.directory),
}
Expand Down
3 changes: 0 additions & 3 deletions lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ mod status;
mod task;
mod utils;

#[cfg(feature = "internal-testing-api")]
mod privtests;

#[cfg(feature = "install")]
mod blockdev;
#[cfg(feature = "install")]
Expand Down
212 changes: 0 additions & 212 deletions lib/src/privtests.rs

This file was deleted.

3 changes: 3 additions & 0 deletions tests-integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ cap-std-ext = "4"
clap = { version= "4.5.4", features = ["derive","cargo"] }
fn-error-context = "0.2.1"
libtest-mimic = "0.7.3"
rustix = { "version" = "0.38.34", features = ["thread", "fs", "system", "process"] }
serde = { features = ["derive"], version = "1.0.199" }
serde_json = "1.0.116"
tempfile = "3.10.1"
xshell = { version = "0.2.6" }
Loading

0 comments on commit 0a7a7eb

Please sign in to comment.