Skip to content

nfstest: migrate local integration test to Apple containers#31

Merged
kchiu merged 2 commits into
mainfrom
migrate-nfstest-apple-container
Jun 30, 2026
Merged

nfstest: migrate local integration test to Apple containers#31
kchiu merged 2 commits into
mainfrom
migrate-nfstest-apple-container

Conversation

@kchiu

@kchiu kchiu commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

What this changes

The local NFS integration test (make nfstest) now runs entirely on
Apple's container runtime. Previously
it needed three different tools stitched together — Earthly to build a
Docker image, Docker to run the server, and a QEMU virtual machine
(booted from a downloaded Alpine image + cloud-init) to act as the NFS client,
reached over SSH. This replaces all of that with two plain containers.

Why

make nfstest checks that the Arctic Wolf NFS server actually works against a
real Linux NFS client (the upstream nfstest_posix suite). To do that you need
a Linux machine that can mount -t nfs. On a Mac the old setup spun up a full
QEMU VM for this. Apple's container runtime can run Linux containers natively
on macOS, each with its own IP address, so we can run both the server and the
client as lightweight containers and skip the VM, Docker, and Earthly entirely.

How it works now

make nfstest starts two containers on the default 192.168.64.0/24 network:

  1. Server — the Arctic Wolf NFS server.
  2. Client — runs nfstest_posix, mounts the server's /data export, and
    runs the POSIX read/write tests against it.
make nfstest                     # run the test (read,write)
make nfstest TESTCASE=read       # pick which POSIX cases to run

The one tricky part: a custom kernel

Apple's default container kernel is built without the in-kernel NFS client
(CONFIG_NFS_FS is off, and it has no loadable-module support), so a container
simply cannot mount NFS out of the box — mount -t nfs fails with
No such device.

To fix this, the client container boots a custom kernel: we take Apple's own
kernel config (extracted from a running container) and rebuild the same kernel
version with the NFS v3 client compiled in. This is a one-time, cached build:

make nfstest-kernel              # builds nfstest/kernel/out/Image (cached)

The compiled kernel binary (~16 MB) is gitignored; the config it's built from
is committed so the build is reproducible.

File guide

Path Purpose
nfstest/server/Dockerfile Builds the Arctic Wolf server image
nfstest/client/Dockerfile Builds the nfstest client image
nfstest/kernel/ Builds the NFS-enabled kernel + Apple's base config
nfstest/config/arcticwolf.test.toml Server config used by the test
nfstest/scripts/nfstest.py Orchestration (build / start / test / stop)
Makefile New targets: nfstest, nfstest-build, nfstest-kernel, nfstest-up, nfstest-down

Removed: the QEMU VM definition (nfstest/vm/), the SSH-based test runner
(nfstest/scripts/runner.py), and the Earthly server-docker / client-vm
targets.

Scope notes

  • make build / test / lint are unchanged (still Earthly).
  • GitHub Actions CI is untouched — it runs on Linux with its own Docker/k3s
    flow, and Apple container is macOS-only. This PR only changes the local
    developer test.

Test results

make nfstest passes end-to-end on macOS (Apple Silicon):

15 tests (15 passed, 0 failed)
NFS integration test PASSED ✓

@kchiu
kchiu force-pushed the migrate-nfstest-apple-container branch from 7864004 to 1db859d Compare June 29, 2026 02:54
kchiu added 2 commits June 29, 2026 23:57
Run the end-to-end NFSv3 integration test entirely on Apple's `container`
runtime, replacing the previous Earthly + Docker + QEMU pipeline. The server
and an nfstest_posix client now run as two containers on the default bridge;
the client mounts the server's /data export and runs the POSIX read/write
suite.

Apple's default container kernel ships with CONFIG_NFS_FS disabled (and no
loadable modules), so the client boots a custom kernel rebuilt from Apple's
own config with NFS v3 compiled in. `make nfstest-kernel` builds it once and
caches it under nfstest/kernel/out/ (gitignored).

- nfstest/server/Dockerfile, nfstest/client/Dockerfile: images built via
  `container build`
- nfstest/kernel/: NFS-enabled kernel build + Apple's extracted base config
- nfstest/config/arcticwolf.test.toml: server config baked into the image
- nfstest/scripts/{nfstest.py,config.py}: orchestration via the container CLI
- Makefile: nfstest, nfstest-build, nfstest-kernel, nfstest-up, nfstest-down
- remove obsolete QEMU VM + SSH runner; drop Earthly server-docker/client-vm

Signed-off-by: Kuan-Kai Chiu <[email protected]>
@kchiu
kchiu force-pushed the migrate-nfstest-apple-container branch from 1db859d to 0eadc0e Compare June 30, 2026 03:59
@kchiu
kchiu merged commit a15daf4 into main Jun 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant