Skip to content

Commit 7f353f9

Browse files
refactor(tests): make each driver suite its own workspace
Driver suites test one driver each and share nothing with each other, so give each its own workspace and lockfile instead of one drivers workspace. A change to one driver's tests or dependencies then can't affect another driver's build or cache. tests/suites/drivers/podman is now a workspace, and the drivers workspace is gone. The test runner's --family takes the path of a workspace under tests/suites/, such as drivers/podman, and rejects absolute paths and parent components. The E2E suites matrix names the driver rows by that path, runs every package of a row without a package, and still selects every driver suite for the drivers family; job and artifact names are unchanged. The fmt, clippy and lockfile alignment lists name the podman workspace. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
1 parent 3941a00 commit 7f353f9

10 files changed

Lines changed: 106 additions & 51 deletions

File tree

‎.github/workflows/branch-checks.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ jobs:
234234
cargo fmt --manifest-path tests/tmachine/Cargo.toml --all -- --check
235235
cargo fmt --manifest-path tests/runner/Cargo.toml --all -- --check
236236
cargo fmt --manifest-path tests/suites/conformance/Cargo.toml --all -- --check
237-
cargo fmt --manifest-path tests/suites/drivers/Cargo.toml --all -- --check
237+
cargo fmt --manifest-path tests/suites/drivers/podman/Cargo.toml --all -- --check
238238
cargo fmt --manifest-path tests/suites/features/Cargo.toml --all -- --check
239239
cargo fmt --manifest-path tests/support/Cargo.toml --all -- --check
240240
@@ -299,7 +299,7 @@ jobs:
299299
cargo clippy --locked --manifest-path tests/tmachine/Cargo.toml --all-targets -- -D warnings
300300
cargo clippy --locked --manifest-path tests/runner/Cargo.toml --all-targets -- -D warnings
301301
cargo clippy --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --all-targets -- -D warnings
302-
cargo clippy --locked --manifest-path tests/suites/drivers/Cargo.toml --workspace --all-targets -- -D warnings
302+
cargo clippy --locked --manifest-path tests/suites/drivers/podman/Cargo.toml --workspace --all-targets -- -D warnings
303303
cargo clippy --locked --manifest-path tests/suites/features/Cargo.toml --workspace --all-targets -- -D warnings
304304
cargo clippy --locked --manifest-path tests/support/Cargo.toml --all-targets -- -D warnings
305305

‎.github/workflows/e2e-suites.yml‎

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Runs testkit suites in tmachine environments on CI. Each row of `ROWS` below
5-
# names a tmachine environment and installer, the family (a workspace under
6-
# tests/suites/) and the package in it, the gateway name the installer
7-
# registers, and the runner label for the environment's architecture.
8-
# `openshell-test-runner` builds the tests, boots the environment, runs them
9-
# inside it and checks the results. The `family` input selects the rows of one
10-
# family; leave it empty to run every row.
5+
# names a tmachine environment and installer, the family (the path of a
6+
# workspace under tests/suites/, such as conformance or drivers/podman) and,
7+
# optionally, the package in it, the gateway name the installer registers, and
8+
# the runner label for the environment's architecture. `openshell-test-runner`
9+
# builds the tests, boots the environment, runs them inside it and checks the
10+
# results. The `family` input selects the rows of one family, including the
11+
# workspaces under it (drivers selects drivers/podman); leave it empty to run
12+
# every row.
1113

1214
name: E2E Suites
1315

1416
on:
1517
workflow_call:
1618
inputs:
1719
family:
18-
description: Run only the rows of this family (for example conformance); empty runs every row
20+
description: Run only the rows of this family and the workspaces under it (for example conformance or drivers); empty runs every row
1921
required: false
2022
type: string
2123
default: ""
@@ -62,7 +64,9 @@ jobs:
6264
# Only amd64 for now: CI has no arm64 runner with KVM for tmachine,
6365
# and the caller only builds amd64 inputs. The gateway is the name the
6466
# installer registers with the CLI: `openshell` for the packages,
65-
# `tmachine` for the k3s and binaries installers.
67+
# `tmachine` for the k3s and binaries installers. A row without a
68+
# package runs every package in the workspace; each driver suite is a
69+
# workspace of its own.
6670
rows='[
6771
{"environment":"ubuntu-docker-rootful","installer":"deb","family":"conformance","package":"conformance","gateway":"openshell","runner":"ubuntu-24.04"},
6872
{"environment":"fedora-podman-rootful","installer":"rpm","family":"conformance","package":"conformance","gateway":"openshell","runner":"ubuntu-24.04"},
@@ -75,17 +79,22 @@ jobs:
7579
{"environment":"fedora-podman-rootless","installer":"rpm","family":"features","package":"oci-image","gateway":"openshell","runner":"ubuntu-24.04"},
7680
{"environment":"fedora-podman-rootful-keycloak","installer":"rpm","family":"features","package":"keycloak-provider-refresh","gateway":"openshell","runner":"ubuntu-24.04"},
7781
{"environment":"fedora-podman-rootless-keycloak","installer":"rpm","family":"features","package":"keycloak-provider-refresh","gateway":"openshell","runner":"ubuntu-24.04"},
78-
{"environment":"fedora-podman-rootful-userns-default","installer":"binaries","family":"drivers","package":"podman","gateway":"tmachine","runner":"ubuntu-24.04"},
79-
{"environment":"fedora-podman-rootful-userns-auto","installer":"binaries","family":"drivers","package":"podman","gateway":"tmachine","runner":"ubuntu-24.04"},
80-
{"environment":"fedora-podman-rootful-userns-keep-id","installer":"binaries","family":"drivers","package":"podman","gateway":"tmachine","runner":"ubuntu-24.04"},
81-
{"environment":"fedora-podman-rootful-userns-private","installer":"binaries","family":"drivers","package":"podman","gateway":"tmachine","runner":"ubuntu-24.04"},
82-
{"environment":"fedora-podman-rootless-userns-default","installer":"binaries","family":"drivers","package":"podman","gateway":"tmachine","runner":"ubuntu-24.04"},
83-
{"environment":"fedora-podman-rootless-userns-auto","installer":"binaries","family":"drivers","package":"podman","gateway":"tmachine","runner":"ubuntu-24.04"},
84-
{"environment":"fedora-podman-rootless-userns-keep-id","installer":"binaries","family":"drivers","package":"podman","gateway":"tmachine","runner":"ubuntu-24.04"},
85-
{"environment":"fedora-podman-rootless-userns-private","installer":"binaries","family":"drivers","package":"podman","gateway":"tmachine","runner":"ubuntu-24.04"}
82+
{"environment":"fedora-podman-rootful-userns-default","installer":"binaries","family":"drivers/podman","gateway":"tmachine","runner":"ubuntu-24.04"},
83+
{"environment":"fedora-podman-rootful-userns-auto","installer":"binaries","family":"drivers/podman","gateway":"tmachine","runner":"ubuntu-24.04"},
84+
{"environment":"fedora-podman-rootful-userns-keep-id","installer":"binaries","family":"drivers/podman","gateway":"tmachine","runner":"ubuntu-24.04"},
85+
{"environment":"fedora-podman-rootful-userns-private","installer":"binaries","family":"drivers/podman","gateway":"tmachine","runner":"ubuntu-24.04"},
86+
{"environment":"fedora-podman-rootless-userns-default","installer":"binaries","family":"drivers/podman","gateway":"tmachine","runner":"ubuntu-24.04"},
87+
{"environment":"fedora-podman-rootless-userns-auto","installer":"binaries","family":"drivers/podman","gateway":"tmachine","runner":"ubuntu-24.04"},
88+
{"environment":"fedora-podman-rootless-userns-keep-id","installer":"binaries","family":"drivers/podman","gateway":"tmachine","runner":"ubuntu-24.04"},
89+
{"environment":"fedora-podman-rootless-userns-private","installer":"binaries","family":"drivers/podman","gateway":"tmachine","runner":"ubuntu-24.04"}
8690
]'
87-
matrix=$(jq -c --arg family "${FAMILY}" \
88-
'{include: map(select($family == "" or .family == $family))}' <<< "$rows")
91+
# `suite` names the row's tests in the job and artifact names.
92+
matrix=$(jq -c --arg family "${FAMILY}" '{include: map(
93+
select($family == "" or .family == $family or (.family | startswith($family + "/")))
94+
| .package //= ""
95+
| .suite = (if .package == "" then .family else "\(.family)/\(.package)" end)
96+
| .artifact = ([.suite, .environment, .installer] | join("-") | gsub("/"; "-"))
97+
)}' <<< "$rows")
8998
if [ "$(jq '.include | length' <<< "$matrix")" -eq 0 ]; then
9099
echo "::error::No E2E suites match family '${FAMILY}'"
91100
exit 1
@@ -94,7 +103,7 @@ jobs:
94103
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT"
95104
96105
suites:
97-
name: E2E suites (${{ matrix.family }}/${{ matrix.package }}, ${{ matrix.environment }}, ${{ matrix.installer }})
106+
name: E2E suites (${{ matrix.suite }}, ${{ matrix.environment }}, ${{ matrix.installer }})
98107
needs: select
99108
strategy:
100109
fail-fast: false
@@ -158,11 +167,15 @@ jobs:
158167
# Retry dependency preparation, then run the suites once. The runner
159168
# builds the suites for the guest, so it needs no prepared archives.
160169
nix build --no-link .#openshell-test-runner || nix build --no-link .#openshell-test-runner
170+
packages=()
171+
if [ -n "${PACKAGE}" ]; then
172+
packages=(--package "${PACKAGE}")
173+
fi
161174
nix run .#openshell-test-runner -- \
162175
--environment "${ENVIRONMENT}" \
163176
--installer "${INSTALLER}" \
164177
--family "${FAMILY}" \
165-
--package "${PACKAGE}" \
178+
"${packages[@]}" \
166179
--gateway "${GATEWAY}" \
167180
--results artifacts/test-results
168181
@@ -175,7 +188,7 @@ jobs:
175188
if: always()
176189
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
177190
with:
178-
name: e2e-results-${{ matrix.family }}-${{ matrix.package }}-${{ matrix.environment }}-${{ matrix.installer }}
191+
name: e2e-results-${{ matrix.artifact }}
179192
path: artifacts/test-results
180193
if-no-files-found: ignore
181194
retention-days: 7

‎CI.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ the DEB on Ubuntu with Docker and installs the CLI and gateway RPMs on Fedora wi
166166
rootful and rootless Podman. These lanes run conformance using the matching runtime
167167
images. Release Dev, Release, and Pre-release use the same package installers.
168168
The feature suites (`tests/suites/features`) run the same way, on the
169-
package installers. The Podman driver suite (`tests/suites/drivers`) and the
169+
package installers. The Podman driver suite (`tests/suites/drivers/podman`) and the
170170
`e2e-podman` lane retain the binary installer because they configure its system
171171
service, local HTTP gateway, and CLI path. The driver suite and `e2e-podman` run
172172
only in `Branch E2E Checks`. The manual Integration Tests workflow runs the

‎TESTING.md‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ by `OPENSHELL_BIN`. See
181181
[tests/testkit/README.md](tests/testkit/README.md) for how to write and run
182182
tests.
183183

184-
Suites live under `tests/suites/<family>/`. Each family is a Cargo workspace
185-
with its own lockfile. Run the `conformance` suites against a local Docker
184+
Suites live under `tests/suites/`, in Cargo workspaces with their own
185+
lockfiles: `conformance`, `features`, and one workspace per driver suite under
186+
`drivers/<driver>`. Run the `conformance` suites against a local Docker
186187
gateway with:
187188

188189
```shell
@@ -218,7 +219,9 @@ Adapted from the handover notes in NVIDIA/OpenShell#4629 by Evan Lezar.
218219
### Running suites in a tmachine environment (`tests/runner/`)
219220

220221
`openshell-test-runner` runs a test family inside a tmachine VM, against the
221-
OpenShell that the VM's installer set up.
222+
OpenShell that the VM's installer set up. `--family` is the path of the
223+
workspace under `tests/suites/`, such as `conformance` or `drivers/podman`, and
224+
`--package` narrows it to some of its packages.
222225

223226
```shell
224227
nix run .#openshell-test-runner -- \
@@ -527,16 +530,20 @@ the same filter for the generated inventory, so excluded binaries cannot appear
527530
as false passes or silently re-enter the archive.
528531

529532
Driver suites live in `tests/suites/drivers/<driver>`, with the package named
530-
after the driver. The Podman driver suite (`tests/suites/drivers/podman`)
531-
compares OpenShell and direct Podman user-namespace mappings.
533+
after the driver. Each driver suite is its own workspace with its own lockfile,
534+
so a change to one driver's tests or dependencies doesn't touch another's. Add
535+
a new one to the `rust:format`, `rust:format:check` and `rust:lint` tasks, the
536+
matching lines in `branch-checks.yml`, and `ALIGNED_WORKSPACES`. The Podman
537+
driver suite (`tests/suites/drivers/podman`) compares OpenShell and direct
538+
Podman user-namespace mappings.
532539
Each `fedora-podman-{rootful,rootless}-userns-<mode>` environment configures
533540
the gateway with one mode (`default`, `auto`, `keep-id` or `private`); only the
534541
`binaries` installer applies it:
535542

536543
```shell
537544
nix run .#openshell-test-runner -- \
538545
--environment fedora-podman-rootless-userns-keep-id --installer binaries \
539-
--gateway tmachine --family drivers --package podman
546+
--gateway tmachine --family drivers/podman
540547
```
541548

542549
The `oci-image` feature suite (`tests/suites/features/oci-image`) checks OCI

‎tasks/rust.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ run = [
4040
"cargo clippy --manifest-path tests/tmachine/Cargo.toml --all-targets -- -D warnings",
4141
"cargo clippy --manifest-path tests/runner/Cargo.toml --all-targets -- -D warnings",
4242
"cargo clippy --manifest-path tests/suites/conformance/Cargo.toml --workspace --all-targets -- -D warnings",
43-
"cargo clippy --manifest-path tests/suites/drivers/Cargo.toml --workspace --all-targets -- -D warnings",
43+
"cargo clippy --manifest-path tests/suites/drivers/podman/Cargo.toml --workspace --all-targets -- -D warnings",
4444
"cargo clippy --manifest-path tests/suites/features/Cargo.toml --workspace --all-targets -- -D warnings",
4545
"cargo clippy --manifest-path tests/support/Cargo.toml --all-targets -- -D warnings",
4646
]
@@ -59,7 +59,7 @@ run = [
5959
"cargo fmt --manifest-path tests/tmachine/Cargo.toml --all",
6060
"cargo fmt --manifest-path tests/runner/Cargo.toml --all",
6161
"cargo fmt --manifest-path tests/suites/conformance/Cargo.toml --all",
62-
"cargo fmt --manifest-path tests/suites/drivers/Cargo.toml --all",
62+
"cargo fmt --manifest-path tests/suites/drivers/podman/Cargo.toml --all",
6363
"cargo fmt --manifest-path tests/suites/features/Cargo.toml --all",
6464
"cargo fmt --manifest-path tests/support/Cargo.toml --all",
6565
]
@@ -77,7 +77,7 @@ run = [
7777
"cargo fmt --manifest-path tests/tmachine/Cargo.toml --all -- --check",
7878
"cargo fmt --manifest-path tests/runner/Cargo.toml --all -- --check",
7979
"cargo fmt --manifest-path tests/suites/conformance/Cargo.toml --all -- --check",
80-
"cargo fmt --manifest-path tests/suites/drivers/Cargo.toml --all -- --check",
80+
"cargo fmt --manifest-path tests/suites/drivers/podman/Cargo.toml --all -- --check",
8181
"cargo fmt --manifest-path tests/suites/features/Cargo.toml --all -- --check",
8282
"cargo fmt --manifest-path tests/support/Cargo.toml --all -- --check",
8383
]

‎tasks/scripts/check_cargo_lockfile_alignment.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"tests/support",
3939
"tests/testkit",
4040
"tests/suites/conformance",
41-
"tests/suites/drivers",
41+
"tests/suites/drivers/podman",
4242
"tests/suites/features",
4343
)
4444

‎tests/runner/src/main.rs‎

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ struct Cli {
3030
/// The tmachine installer that installs OpenShell, e.g. `deb`.
3131
#[arg(long)]
3232
installer: String,
33-
/// The test family: a workspace under `tests/suites/`, e.g. `conformance`.
33+
/// The test family: the path of a workspace under `tests/suites/`, e.g.
34+
/// `conformance` or `drivers/podman`.
3435
#[arg(long)]
3536
family: String,
3637
/// Only build these packages of the family [default: every package].
@@ -72,16 +73,7 @@ async fn main() -> ExitCode {
7273

7374
async fn run(cli: Cli) -> Result<ExitCode> {
7475
let root = repo_root()?;
75-
ensure!(
76-
!cli.family.is_empty()
77-
&& cli
78-
.family
79-
.chars()
80-
.all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_'),
81-
"--family must name a workspace directly under tests/suites/, got {:?}",
82-
cli.family
83-
);
84-
let workspace = root.join("tests/suites").join(&cli.family);
76+
let workspace = family_workspace(&root, &cli.family)?;
8577
// Absolute, because `load_tmachine` changes the working directory.
8678
let results = std::path::absolute(&cli.results)
8779
.with_context(|| format!("resolve {}", cli.results.display()))?;
@@ -127,6 +119,23 @@ async fn run(cli: Cli) -> Result<ExitCode> {
127119
Ok(status.exit_code())
128120
}
129121

122+
/// The workspace directory of `family`, a relative path under
123+
/// `tests/suites/` such as `drivers/podman`. Each part of the path must be a
124+
/// plain name, so it can't be absolute or leave `tests/suites/`.
125+
fn family_workspace(root: &Path, family: &str) -> Result<PathBuf> {
126+
let plain = |part: &str| {
127+
!part.is_empty()
128+
&& part
129+
.chars()
130+
.all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_')
131+
};
132+
ensure!(
133+
family.split('/').all(plain),
134+
"--family must be the path of a workspace under tests/suites/, such as conformance or drivers/podman, got {family:?}"
135+
);
136+
Ok(root.join("tests/suites").join(family))
137+
}
138+
130139
/// On GitHub Actions, show `message` as an error on the run's summary page.
131140
fn annotate(title: &str, message: &str) {
132141
if std::env::var_os("GITHUB_ACTIONS").is_none() {
@@ -163,3 +172,32 @@ fn repo_root() -> Result<PathBuf> {
163172
);
164173
Ok(PathBuf::from(String::from_utf8(output.stdout)?.trim()))
165174
}
175+
176+
#[cfg(test)]
177+
mod tests {
178+
use super::*;
179+
180+
#[test]
181+
fn family_is_a_path_under_tests_suites() {
182+
let root = Path::new("/repo");
183+
assert_eq!(
184+
family_workspace(root, "conformance").unwrap(),
185+
Path::new("/repo/tests/suites/conformance")
186+
);
187+
assert_eq!(
188+
family_workspace(root, "drivers/podman").unwrap(),
189+
Path::new("/repo/tests/suites/drivers/podman")
190+
);
191+
for family in [
192+
"",
193+
"/etc",
194+
"drivers/",
195+
"drivers//podman",
196+
"../tests",
197+
"drivers/../..",
198+
"a b",
199+
] {
200+
assert!(family_workspace(root, family).is_err(), "{family:?}");
201+
}
202+
}
203+
}

‎tests/suites/drivers/Cargo.toml‎

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

‎tests/suites/drivers/podman/Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
# Each driver suite is its own workspace, with its own lockfile.
45
[package]
56
name = "podman"
67
description = "Drivers suite: Podman driver behavior, such as user namespaces"
@@ -15,3 +16,5 @@ publish = false
1516
container-engine-support = { path = "../../../support/container-engine" }
1617
openshell-testkit = { path = "../../../testkit/testkit" }
1718
podman-support = { path = "../../../support/podman" }
19+
20+
[workspace]

0 commit comments

Comments
 (0)