Skip to content

Commit 571329b

Browse files
committed
tests: replace INTEGRATION.md with automated QEMU e2e suite
- examples/fedora/Containerfile: add serial autologin (safe now that CI no longer pushes this image publicly) so QEMU tests run unattended - tests/e2e.py: pexpect-based runner; boots disk.raw in QEMU and checks: cbootc status output, BLS title != todoOS, rollback fails cleanly with one entry, grubenv exists, config.toml present - .github/workflows/e2e.yml: builds base image from source on every PR (catches regressions in Containerfile.base and Rust code), then stacks the example Containerfile on top and runs e2e.py; GHA layer cache keeps the slow dnf+dracut build fast after the first run - Remove tests/INTEGRATION.md
1 parent 6dd3e32 commit 571329b

6 files changed

Lines changed: 257 additions & 227 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: E2E Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
e2e:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Enable KVM
16+
run: |
17+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
18+
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
19+
sudo udevadm control --reload-rules
20+
sudo udevadm trigger --name-match=kvm
21+
22+
- name: Install dependencies
23+
run: |
24+
sudo apt-get update -q
25+
sudo apt-get install -y -q \
26+
qemu-system-x86 ovmf podman python3-pexpect
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Login to ghcr.io
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
# Build the base image from source (covers PRs that change Containerfile.base
39+
# or the Rust code compiled inside it). Layer cache keeps this fast after
40+
# the first run.
41+
- name: Build base image
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: .
45+
file: Containerfile.base
46+
push: false
47+
load: true
48+
tags: composefs-os-fedora:pr
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max
51+
52+
- name: Build test image
53+
run: |
54+
podman build \
55+
--build-arg BASE_IMAGE=composefs-os-fedora:pr \
56+
-t composefs-os-test:latest \
57+
-f examples/fedora/Containerfile .
58+
59+
- name: Install to disk image
60+
run: |
61+
sudo podman run --rm --privileged \
62+
-v ${{ github.workspace }}:/output \
63+
-v /var/lib/containers:/var/lib/containers \
64+
-v /var/tmp:/var/tmp \
65+
composefs-os-test:latest \
66+
cbootc install to-disk /output/disk.raw --size 5G
67+
68+
- name: Run e2e tests
69+
run: python3 tests/e2e.py disk.raw
70+
71+
- name: Upload disk image on failure
72+
if: failure()
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: disk-raw
76+
path: disk.raw
77+
retention-days: 1

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2024"
55
description = "Upgrade/rollback tool embedded in composefs-os images"
66
license = "MIT"
7-
repository = "https://github.com/OWNER/composefs-os"
7+
repository = "https://github.com/henrywang/composefs-os"
88

99
[dependencies]
1010
anyhow = "1.0"

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ See [DESIGN.md](DESIGN.md) for rationale and architecture.
2121

2222
| Image | Status |
2323
|-------|--------|
24-
| `ghcr.io/OWNER/composefs-os-fedora:43` | Working |
24+
| `ghcr.io/henrywang/composefs-os-fedora:43` | Working |
2525
| Ubuntu | Planned |
2626
| Arch Linux | Planned |
2727

28-
Replace `OWNER` with the GitHub organisation or username hosting the packages.
2928

3029
## Quick Start
3130

@@ -35,7 +34,7 @@ sudo podman run --rm --privileged \
3534
-v $(pwd):/output \
3635
-v /var/lib/containers:/var/lib/containers \
3736
-v /var/tmp:/var/tmp \
38-
ghcr.io/OWNER/composefs-os-fedora:43 \
37+
ghcr.io/henrywang/composefs-os-fedora:43 \
3938
cbootc install to-disk /output/disk.raw --size 10G
4039

4140
# Boot it
@@ -51,7 +50,7 @@ The published base images are a starting point. Add your own packages and
5150
configuration in a derived `Containerfile`:
5251

5352
```dockerfile
54-
FROM ghcr.io/OWNER/composefs-os-fedora:43
53+
FROM ghcr.io/henrywang/composefs-os-fedora:43
5554

5655
# Add packages
5756
RUN dnf install -y vim htop && dnf clean all
@@ -81,7 +80,7 @@ cbootc rollback
8180
systemctl reboot
8281

8382
# Switch to a different image
84-
cbootc switch docker://ghcr.io/OWNER/composefs-os-fedora:43
83+
cbootc switch docker://ghcr.io/henrywang/composefs-os-fedora:43
8584
```
8685

8786
The tracked image reference is stored in `/var/lib/cbootc/config.toml` and
@@ -105,10 +104,11 @@ composefs-os/
105104
ubuntu/
106105
Containerfile Ubuntu (stub — not yet functional)
107106
tests/
108-
INTEGRATION.md Manual integration test checklist
107+
e2e.py QEMU-based end-to-end test suite
109108
.github/workflows/
110109
ci.yml Rust build, test, lint
111110
container.yml Build and push base image to ghcr.io
111+
e2e.yml End-to-end tests (boots in QEMU)
112112
```
113113

114114
## Known Limitations

examples/fedora/Containerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Template for a custom Fedora composefs-os image.
22
#
33
# Pattern:
4-
# 1. FROM ghcr.io/OWNER/composefs-os-fedora:43
4+
# 1. FROM ghcr.io/henrywang/composefs-os-fedora:43
55
# 2. Install packages, write config — /etc and /var are normal here
66
# 3. Keep the LABEL block at the bottom
77
#
88
# Build locally:
99
# podman build -t my-fedora-cfs:latest \
10-
# --build-arg BASE_IMAGE=ghcr.io/OWNER/composefs-os-fedora:43 \
10+
# --build-arg BASE_IMAGE=ghcr.io/henrywang/composefs-os-fedora:43 \
1111
# -f examples/fedora/Containerfile .
1212
#
1313
# Deploy to a disk image file:
@@ -16,14 +16,19 @@
1616
# -v /var/tmp:/var/tmp \
1717
# my-fedora-cfs:latest cbootc install to-disk /output/disk.raw --size 10G
1818

19-
ARG BASE_IMAGE=ghcr.io/OWNER/composefs-os-fedora:43
19+
ARG BASE_IMAGE=ghcr.io/henrywang/composefs-os-fedora:43
2020
FROM ${BASE_IMAGE}
2121

2222
# --- Customise below this line -------------------------------------------
2323

24-
# Set hostname
2524
RUN echo 'myhost' > /etc/hostname
2625

26+
# Serial console autologin — convenient for local QEMU testing.
27+
# Remove or replace with SSH keys for any internet-facing deployment.
28+
RUN mkdir -p /usr/lib/systemd/system/serial-getty@ttyS0.service.d && \
29+
printf '[Service]\nExecStart=\nExecStart=-/sbin/agetty --autologin root --noclear %%I 115200 vt220\n' \
30+
> /usr/lib/systemd/system/serial-getty@ttyS0.service.d/autologin.conf
31+
2732
# Add your packages here, e.g.:
2833
# RUN dnf install -y --setopt=install_weak_deps=False vim htop && dnf clean all
2934

tests/INTEGRATION.md

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

0 commit comments

Comments
 (0)