Skip to content

Commit 70edd01

Browse files
authored
Merge pull request #576 from cgwalters/testing
tests: Drop `internal-testing-api`, move to tests-integration
2 parents e51bf9e + 9be6b5a commit 70edd01

File tree

16 files changed

+183
-371
lines changed

16 files changed

+183
-371
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ jobs:
5757
- name: Build container (fedora)
5858
run: sudo podman build --build-arg=base=quay.io/fedora/fedora-bootc:40 -t localhost/bootc -f hack/Containerfile .
5959
- name: Container integration
60-
run: sudo podman run --rm localhost/bootc bootc internal-tests run-container-integration
61-
- name: Privileged tests
62-
run: sudo podman run --rm --privileged -v /run/systemd:/run/systemd -v /:/run/host --pid=host localhost/bootc bootc internal-tests run-privileged-integration
60+
run: sudo podman run --rm localhost/bootc bootc-integration-tests container
6361
cargo-deny:
6462
runs-on: ubuntu-latest
6563
steps:
@@ -78,14 +76,22 @@ jobs:
7876
uses: actions/checkout@v4
7977
- name: Ensure host skopeo is disabled
8078
run: sudo rm -f /bin/skopeo /usr/bin/skopeo
79+
- name: Free up disk space on runner
80+
run: sudo ./ci/clean-gha-runner.sh
8181
- name: Integration tests
8282
run: |
8383
set -xeu
8484
sudo podman build -t localhost/bootc -f hack/Containerfile .
85+
export CARGO_INCREMENTAL=0 # because we aren't caching the test runner bits
86+
cargo build --release -p tests-integration
87+
df -h /
88+
sudo install -m 0755 target/release/tests-integration /usr/bin/bootc-integration-tests
89+
rm target -rf
90+
df -h /
8591
# Nondestructive but privileged tests
86-
cargo run -p tests-integration host-privileged localhost/bootc
92+
sudo bootc-integration-tests host-privileged localhost/bootc
8793
# Finally the install-alongside suite
88-
cargo run -p tests-integration install-alongside localhost/bootc
94+
sudo bootc-integration-tests install-alongside localhost/bootc
8995
docs:
9096
if: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') }}
9197
runs-on: ubuntu-latest

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ prefix ?= /usr
33
all:
44
cargo build --release
55

6-
all-test:
7-
cargo build --release --all-features
8-
96
install:
107
install -D -m 0755 -t $(DESTDIR)$(prefix)/bin target/release/bootc
118
install -d -m 0755 $(DESTDIR)$(prefix)/lib/systemd/system-generators/
@@ -22,11 +19,14 @@ install:
2219
done
2320
install -D -m 0644 -t $(DESTDIR)/$(prefix)/lib/systemd/system systemd/*.service systemd/*.timer
2421

22+
install-with-tests: install
23+
install -D -m 0755 target/release/tests-integration $(DESTDIR)$(prefix)/bin/bootc-integration-tests
24+
2525
bin-archive: all
2626
$(MAKE) install DESTDIR=tmp-install && tar --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
2727

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

3131
install-kola-tests:
3232
install -D -t $(DESTDIR)$(prefix)/lib/coreos-assembler/tests/kola/bootc tests/kolainst/*

ci/clean-gha-runner.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -xeuo pipefail
3+
df -h
4+
docker image prune --all --force > /dev/null
5+
rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android
6+
apt-get remove -y '^aspnetcore-.*' > /dev/null
7+
apt-get remove -y '^dotnet-.*' > /dev/null
8+
apt-get remove -y '^llvm-.*' > /dev/null
9+
apt-get remove -y 'php.*' > /dev/null
10+
apt-get remove -y '^mongodb-.*' > /dev/null
11+
apt-get remove -y '^mysql-.*' > /dev/null1
12+
apt-get remove -y azure-cli google-chrome-stable firefox mono-devel >/dev/null
13+
df -h

lib/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,4 @@ default = ["install"]
5454
install = []
5555
# Implementation detail of man page generation.
5656
docgen = ["clap_mangen"]
57-
# This feature should only be enabled in CI environments.
58-
internal-testing-api = ["xshell"]
57+

lib/src/cli.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -170,28 +170,6 @@ impl InternalsOpts {
170170
const GENERATOR_BIN: &'static str = "bootc-systemd-generator";
171171
}
172172

173-
/// Options for internal testing
174-
#[derive(Debug, clap::Subcommand, PartialEq, Eq)]
175-
pub(crate) enum TestingOpts {
176-
/// Execute integration tests that require a privileged container
177-
RunPrivilegedIntegration {},
178-
/// Execute integration tests that target a not-privileged ostree container
179-
RunContainerIntegration {},
180-
/// Block device setup for testing
181-
PrepTestInstallFilesystem { blockdev: Utf8PathBuf },
182-
/// e2e test of install to-filesystem
183-
TestInstallFilesystem {
184-
image: String,
185-
blockdev: Utf8PathBuf,
186-
},
187-
#[clap(name = "verify-selinux")]
188-
VerifySELinux {
189-
root: String,
190-
#[clap(long)]
191-
warn: bool,
192-
},
193-
}
194-
195173
/// Deploy and transactionally in-place with bootable container images.
196174
///
197175
/// The `bootc` project currently uses ostree-containers as a backend
@@ -314,10 +292,6 @@ pub(crate) enum Opt {
314292
#[clap(subcommand)]
315293
#[clap(hide = true)]
316294
Internals(InternalsOpts),
317-
/// Internal integration testing helpers.
318-
#[clap(hide(true), subcommand)]
319-
#[cfg(feature = "internal-testing-api")]
320-
InternalTests(TestingOpts),
321295
#[clap(hide(true))]
322296
#[cfg(feature = "docgen")]
323297
Man(ManOpts),
@@ -714,8 +688,6 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
714688
}
715689
InternalsOpts::FixupEtcFstab => crate::deploy::fixup_etc_fstab(&root),
716690
},
717-
#[cfg(feature = "internal-testing-api")]
718-
Opt::InternalTests(opts) => crate::privtests::run(opts).await,
719691
#[cfg(feature = "docgen")]
720692
Opt::Man(manopts) => crate::docgen::generate_manpages(&manopts.directory),
721693
}

lib/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ mod status;
3030
mod task;
3131
mod utils;
3232

33-
#[cfg(feature = "internal-testing-api")]
34-
mod privtests;
35-
3633
#[cfg(feature = "install")]
3734
mod blockdev;
3835
#[cfg(feature = "install")]

lib/src/privtests.rs

Lines changed: 0 additions & 212 deletions
This file was deleted.

tests-integration/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@ cap-std-ext = "4"
1717
clap = { version= "4.5.4", features = ["derive","cargo"] }
1818
fn-error-context = "0.2.1"
1919
libtest-mimic = "0.7.3"
20+
rustix = { "version" = "0.38.34", features = ["thread", "fs", "system", "process"] }
21+
serde = { features = ["derive"], version = "1.0.199" }
22+
serde_json = "1.0.116"
2023
tempfile = "3.10.1"
2124
xshell = { version = "0.2.6" }

0 commit comments

Comments
 (0)