Skip to content

Commit 32940b5

Browse files
test(drivers): port the Podman user-namespace suite to testkit
Rewrite tests/suites/drivers/podman as a testkit test (package podman) that compares a sandbox's UID map with the one Podman gives a container in the same user-namespace mode. Each fedora-podman-{rootful,rootless}-userns-<mode> environment configures that mode for the binaries installer's gateway and publishes it; the packaged installers refuse such environments rather than test without the mode. driver-specific-integration now runs the drivers family through e2e-suites.yml, and the e2e-podman tmachine row moves to its own podman-e2e-integration job. Retire the driver-podman testsuite, its playbooks, fixtures and archive. Each driver suite is its own workspace under tests/suites/drivers/<driver>, with its own lockfile, so a driver can be tested apart from the others. The runner's --family is the path of a workspace under tests/suites/ (drivers/podman), and each part must be a plain name. The family input of e2e-suites.yml also selects the workspaces under it, so "drivers" still selects every driver suite. The suite package is named after the driver, and the support crates take a -support suffix. Branch Checks and the rust tasks format and lint each test workspace as a whole. The Podman support crate's reference container runs with --pull missing instead of --pull never, so it pulls the image when the engine's store doesn't have it. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com> Co-authored-by: Evan Lezar <elezar@nvidia.com>
1 parent 55fcf27 commit 32940b5

31 files changed

Lines changed: 4655 additions & 1148 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +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/podman/Cargo.toml --all -- --check
237238
cargo fmt --manifest-path tests/suites/features/Cargo.toml --all -- --check
238239
cargo fmt --manifest-path tests/support/Cargo.toml --all -- --check
239240
@@ -298,6 +299,7 @@ jobs:
298299
cargo clippy --locked --manifest-path tests/tmachine/Cargo.toml --all-targets -- -D warnings
299300
cargo clippy --locked --manifest-path tests/runner/Cargo.toml --all-targets -- -D warnings
300301
cargo clippy --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --all-targets -- -D warnings
302+
cargo clippy --locked --manifest-path tests/suites/drivers/podman/Cargo.toml --workspace --all-targets -- -D warnings
301303
cargo clippy --locked --manifest-path tests/suites/features/Cargo.toml --workspace --all-targets -- -D warnings
302304
cargo clippy --locked --manifest-path tests/support/Cargo.toml --all-targets -- -D warnings
303305

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,25 @@ jobs:
271271
secrets:
272272
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
273273

274-
# Run driver-specific integration tests:
275-
# These suites require the binary installer's CLI path, local HTTP gateway,
276-
# and system service configuration for their Podman user-namespace fixtures.
274+
# Run the testkit driver suites (tests/suites/drivers) on tmachine. The
275+
# environments and suites are listed in e2e-suites.yml.
277276
driver-specific-integration:
277+
needs: prepare-integration
278+
permissions:
279+
actions: read
280+
contents: read
281+
packages: read
282+
uses: ./.github/workflows/e2e-suites.yml
283+
with:
284+
family: drivers
285+
source-sha: ${{ needs.prepare-integration.outputs.source_sha }}
286+
integration-inputs-artifact-id: ${{ needs.prepare-integration.outputs.integration_inputs_artifact_id }}
287+
secrets:
288+
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
289+
290+
# Run the Podman e2e suite on tmachine. It needs the binary installer's CLI
291+
# path and local HTTP gateway.
292+
podman-e2e-integration:
278293
needs: prepare-integration
279294
permissions:
280295
actions: read
@@ -287,9 +302,7 @@ jobs:
287302
integration-inputs-artifact-id: ${{ needs.prepare-integration.outputs.integration_inputs_artifact_id }}
288303
test-matrix: >-
289304
[
290-
{"environment":"fedora-podman-rootful","installer":"binaries","testsuite":"driver-podman"},
291-
{"environment":"fedora-podman-rootless","installer":"binaries","testsuite":"e2e-podman"},
292-
{"environment":"fedora-podman-rootless","installer":"binaries","testsuite":"driver-podman"}
305+
{"environment":"fedora-podman-rootless","installer":"binaries","testsuite":"e2e-podman"}
293306
]
294307
295308
docker-e2e:
@@ -552,6 +565,7 @@ jobs:
552565
- conformance-integration
553566
- feature-specific-integration
554567
- driver-specific-integration
568+
- podman-e2e-integration
555569
- docker-e2e
556570
- podman-e2e
557571
- podman-additional-ca-e2e

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

Lines changed: 35 additions & 14 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 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"},
@@ -74,10 +78,23 @@ jobs:
7478
{"environment":"fedora-podman-rootful","installer":"rpm","family":"features","package":"oci-image","gateway":"openshell","runner":"ubuntu-24.04"},
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"},
77-
{"environment":"fedora-podman-rootless-keycloak","installer":"rpm","family":"features","package":"keycloak-provider-refresh","gateway":"openshell","runner":"ubuntu-24.04"}
81+
{"environment":"fedora-podman-rootless-keycloak","installer":"rpm","family":"features","package":"keycloak-provider-refresh","gateway":"openshell","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"}
7890
]'
79-
matrix=$(jq -c --arg family "${FAMILY}" \
80-
'{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")
8198
if [ "$(jq '.include | length' <<< "$matrix")" -eq 0 ]; then
8299
echo "::error::No E2E suites match family '${FAMILY}'"
83100
exit 1
@@ -86,7 +103,7 @@ jobs:
86103
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT"
87104
88105
suites:
89-
name: E2E suites (${{ matrix.family }}/${{ matrix.package }}, ${{ matrix.environment }}, ${{ matrix.installer }})
106+
name: E2E suites (${{ matrix.suite }}, ${{ matrix.environment }}, ${{ matrix.installer }})
90107
needs: select
91108
strategy:
92109
fail-fast: false
@@ -150,11 +167,15 @@ jobs:
150167
# Retry dependency preparation, then run the suites once. The runner
151168
# builds the suites for the guest, so it needs no prepared archives.
152169
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
153174
nix run .#openshell-test-runner -- \
154175
--environment "${ENVIRONMENT}" \
155176
--installer "${INSTALLER}" \
156177
--family "${FAMILY}" \
157-
--package "${PACKAGE}" \
178+
"${packages[@]}" \
158179
--gateway "${GATEWAY}" \
159180
--results artifacts/test-results
160181
@@ -167,7 +188,7 @@ jobs:
167188
if: always()
168189
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
169190
with:
170-
name: e2e-results-${{ matrix.family }}-${{ matrix.package }}-${{ matrix.environment }}-${{ matrix.installer }}
191+
name: e2e-results-${{ matrix.artifact }}
171192
path: artifacts/test-results
172193
if-no-files-found: ignore
173194
retention-days: 7

‎CI.md‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,13 @@ selected. DEB and RPM packages build only when integration qualification is sele
165165
the DEB on Ubuntu with Docker and installs the CLI and gateway RPMs on Fedora with
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.
168-
Fedora provider-refresh tests also use RPMs. The Podman driver-specific suites
169-
retain the binary installer because their fixtures configure its system service,
170-
local HTTP gateway, and CLI path. The manual Integration Tests workflow defaults
171-
to the package installers and downloads the packages selected by its matrix.
168+
The feature suites (`tests/suites/features`) run the same way, on the
169+
package installers. The Podman driver suite (`tests/suites/drivers/podman`) and the
170+
`e2e-podman` lane retain the binary installer because they configure its system
171+
service, local HTTP gateway, and CLI path. The driver suite and `e2e-podman` run
172+
only in `Branch E2E Checks`. The manual Integration Tests workflow runs the
173+
remaining tmachine testsuites, such as `e2e-podman`, and downloads the packages
174+
selected by its matrix.
172175

173176
Three opt-in labels enable the long-running E2E suites:
174177

‎TESTING.md‎

Lines changed: 28 additions & 9 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,12 @@ 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. It must name a workspace, so
225+
`drivers` alone fails. The `family` input of the `E2E Suites` workflow instead
226+
selects every row whose family is that name or lies under it, so `drivers`
227+
selects all the driver suites.
222228

223229
```shell
224230
nix run .#openshell-test-runner -- \
@@ -510,7 +516,6 @@ Run the portable subset in a disposable rootless Podman guest:
510516
```shell
511517
nix run .#build-artifacts
512518
nix run .#tmachine -- test fedora-podman-rootless binaries e2e-podman
513-
nix run .#tmachine -- test fedora-podman-rootless binaries driver-podman
514519
```
515520

516521
Print the exact tmachine archive selection as a shell `PODMAN_CI_TESTS` array:
@@ -521,15 +526,29 @@ nix run .#generate-podman-e2e-ci-tests
521526

522527
The `e2e-podman` testsuite runs a nextest archive built with the corresponding
523528
Rust feature and preloads its Python workload image into the rootless Podman
524-
store. The separate `driver-podman` testsuite compares OpenShell and direct
525-
Podman user-namespace mappings for the default, `auto`, `keep-id`, and private
526-
profiles. The E2E archive excludes binaries that still depend on wrapper-owned
529+
store. The E2E archive excludes binaries that still depend on wrapper-owned
527530
gateway controls, SPIFFE fixtures, the caller driver-config setting, or other
528-
guest setup. The `driver-podman` suite replaces the removed `podman_userns` E2E
529-
binary. `tests/tmachine/artifacts.nix` keeps the follow-up exclusions explicit and uses
531+
guest setup. `tests/tmachine/artifacts.nix` keeps the follow-up exclusions explicit and uses
530532
the same filter for the generated inventory, so excluded binaries cannot appear
531533
as false passes or silently re-enter the archive.
532534

535+
Driver suites live in `tests/suites/drivers/<driver>`, with the package named
536+
after the driver. Each driver suite is its own workspace with its own lockfile,
537+
so a change to one driver's tests or dependencies doesn't touch another's. Add
538+
a new one to the `rust:format`, `rust:format:check` and `rust:lint` tasks, the
539+
matching lines in `branch-checks.yml`, and `ALIGNED_WORKSPACES`. The Podman
540+
driver suite (`tests/suites/drivers/podman`) compares OpenShell and direct
541+
Podman user-namespace mappings.
542+
Each `fedora-podman-{rootful,rootless}-userns-<mode>` environment configures
543+
the gateway with one mode (`default`, `auto`, `keep-id` or `private`); only the
544+
`binaries` installer applies it:
545+
546+
```shell
547+
nix run .#openshell-test-runner -- \
548+
--environment fedora-podman-rootless-userns-keep-id --installer binaries \
549+
--gateway tmachine --family drivers/podman
550+
```
551+
533552
The `oci-image` feature suite (`tests/suites/features/oci-image`) checks OCI
534553
image identity and working-directory behavior shared by the Docker and Podman
535554
drivers against installed deb packages on Ubuntu and rpm packages on Fedora.

‎tasks/rust.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +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/podman/Cargo.toml --workspace --all-targets -- -D warnings",
4344
"cargo clippy --manifest-path tests/suites/features/Cargo.toml --workspace --all-targets -- -D warnings",
4445
"cargo clippy --manifest-path tests/support/Cargo.toml --all-targets -- -D warnings",
4546
]
@@ -58,6 +59,7 @@ run = [
5859
"cargo fmt --manifest-path tests/tmachine/Cargo.toml --all",
5960
"cargo fmt --manifest-path tests/runner/Cargo.toml --all",
6061
"cargo fmt --manifest-path tests/suites/conformance/Cargo.toml --all",
62+
"cargo fmt --manifest-path tests/suites/drivers/podman/Cargo.toml --all",
6163
"cargo fmt --manifest-path tests/suites/features/Cargo.toml --all",
6264
"cargo fmt --manifest-path tests/support/Cargo.toml --all",
6365
]
@@ -75,6 +77,7 @@ run = [
7577
"cargo fmt --manifest-path tests/tmachine/Cargo.toml --all -- --check",
7678
"cargo fmt --manifest-path tests/runner/Cargo.toml --all -- --check",
7779
"cargo fmt --manifest-path tests/suites/conformance/Cargo.toml --all -- --check",
80+
"cargo fmt --manifest-path tests/suites/drivers/podman/Cargo.toml --all -- --check",
7881
"cargo fmt --manifest-path tests/suites/features/Cargo.toml --all -- --check",
7982
"cargo fmt --manifest-path tests/support/Cargo.toml --all -- --check",
8083
]

‎tasks/scripts/check_cargo_lockfile_alignment.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"tests/support",
3939
"tests/testkit",
4040
"tests/suites/conformance",
41+
"tests/suites/drivers/podman",
4142
"tests/suites/features",
4243
)
4344

‎tests/runner/src/main.rs‎

Lines changed: 52 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,35 @@ 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+
".",
199+
"..",
200+
"drivers/.",
201+
"a b",
202+
] {
203+
assert!(family_workspace(root, family).is_err(), "{family:?}");
204+
}
205+
}
206+
}

0 commit comments

Comments
 (0)