Skip to content

Commit 1a86a7e

Browse files
committed
test(tmachine): run podman e2e archive
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 66511ea commit 1a86a7e

8 files changed

Lines changed: 265 additions & 8 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ jobs:
261261
test-matrix: >-
262262
[
263263
{"environment":"fedora-podman-rootful","installer":"binaries","testsuite":"driver-podman"},
264+
{"environment":"fedora-podman-rootless","installer":"binaries","testsuite":"e2e-podman"},
264265
{"environment":"fedora-podman-rootless","installer":"binaries","testsuite":"driver-podman"}
265266
]
266267

‎.github/workflows/prepare-integration-inputs.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ jobs:
106106
- name: Build test archives
107107
run: nix run .#build-artifacts-test-archives
108108

109+
- name: Build test workload images
110+
run: nix run .#build-artifacts-test-images
111+
109112
- name: Upload integration inputs
110113
id: upload-integration-inputs
111114
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

‎TESTING.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,24 @@ Rust tests that still apply. Run the Podman-backed Rust CLI e2e suite:
254254
mise run e2e:podman
255255
```
256256

257+
Run the portable subset in a disposable rootless Podman guest:
258+
259+
```shell
260+
nix run .#build-artifacts
261+
nix run .#tmachine -- test fedora-podman-rootless binaries e2e-podman
262+
nix run .#tmachine -- test fedora-podman-rootless binaries driver-podman
263+
```
264+
265+
The `e2e-podman` testsuite runs a nextest archive built with the corresponding
266+
Rust feature and preloads its Python workload image into the rootless Podman
267+
store. The separate `driver-podman` testsuite compares OpenShell and direct
268+
Podman user-namespace mappings for the default, `auto`, `keep-id`, and private
269+
profiles. The E2E archive excludes binaries that still depend on wrapper-owned
270+
gateway controls, host fixtures, missing guest tools, or nondeterministic relay
271+
setup. The `driver-podman` suite replaces the removed `podman_userns` E2E
272+
binary. `tests/artifacts.nix` keeps the follow-up exclusions explicit so those
273+
binaries cannot appear as false passes or silently re-enter the archive.
274+
257275
Run the VM-backed Rust CLI e2e suite:
258276

259277
```shell

‎e2e/rust/tests/live_policy_update.rs‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ use openshell_e2e::harness::output::{extract_field, strip_ansi};
3232
use openshell_e2e::harness::sandbox::SandboxGuard;
3333
use tempfile::NamedTempFile;
3434

35+
const SPARSE_POLICY: &str = include_str!(concat!(
36+
env!("CARGO_MANIFEST_DIR"),
37+
"/../../examples/policy-advisor/sandbox-policy.yaml"
38+
));
39+
3540
// ---------------------------------------------------------------------------
3641
// Policy YAML builders
3742
// ---------------------------------------------------------------------------
@@ -126,6 +131,15 @@ landlock:
126131
Ok(file)
127132
}
128133

134+
fn write_sparse_policy() -> Result<NamedTempFile, String> {
135+
let mut file = NamedTempFile::new().map_err(|e| format!("create temp policy file: {e}"))?;
136+
file.write_all(SPARSE_POLICY.as_bytes())
137+
.map_err(|e| format!("write temp policy file: {e}"))?;
138+
file.flush()
139+
.map_err(|e| format!("flush temp policy file: {e}"))?;
140+
Ok(file)
141+
}
142+
129143
// ---------------------------------------------------------------------------
130144
// CLI helpers
131145
// ---------------------------------------------------------------------------
@@ -629,18 +643,18 @@ async fn live_policy_update_from_empty_network_policies() {
629643
/// no revision remaining `Pending` once the acknowledgement lands.
630644
#[tokio::test]
631645
async fn initial_sparse_policy_is_acknowledged_as_loaded() {
632-
// Repo-relative path to the sparse network-only policy fixture.
633-
let sparse_policy = concat!(
634-
env!("CARGO_MANIFEST_DIR"),
635-
"/../../examples/policy-advisor/sandbox-policy.yaml"
636-
);
646+
let sparse_policy = write_sparse_policy().expect("write sparse policy fixture");
647+
let sparse_policy_path = sparse_policy
648+
.path()
649+
.to_str()
650+
.expect("sparse policy path is not UTF-8");
637651

638652
let mut guard = SandboxGuard::create_keep_with_args(
639653
&[
640654
"--name",
641655
"e2e-sparse-enrich",
642656
"--policy",
643-
sparse_policy,
657+
sparse_policy_path,
644658
"--no-tty",
645659
],
646660
&["sh", "-c", "echo Ready && sleep infinity"],
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
- name: Run Podman E2E archive tests
6+
hosts: all
7+
gather_facts: false
8+
vars:
9+
podman_e2e_test_root: /var/lib/openshell-driver-tests/podman-e2e
10+
tasks:
11+
- name: Wait for SSH
12+
ansible.builtin.wait_for_connection:
13+
14+
- name: Create Podman E2E test directory
15+
become: true
16+
ansible.builtin.file:
17+
path: "{{ podman_e2e_test_root }}"
18+
state: directory
19+
owner: tmachine
20+
group: tmachine
21+
mode: "0700"
22+
23+
- name: Install Podman E2E test bundle
24+
become: true
25+
ansible.builtin.unarchive:
26+
src: "{{ openshell_podman_e2e_test_bundle }}"
27+
dest: "{{ podman_e2e_test_root }}"
28+
owner: tmachine
29+
group: tmachine
30+
31+
- name: Install Podman E2E workload image
32+
become: true
33+
ansible.builtin.copy:
34+
src: "{{ openshell_podman_e2e_workload_image }}"
35+
dest: "{{ podman_e2e_test_root }}/openshell-e2e-python-dev.tar"
36+
owner: tmachine
37+
group: tmachine
38+
mode: "0600"
39+
40+
- name: Load Podman E2E workload image
41+
ansible.builtin.command:
42+
argv:
43+
- podman
44+
- load
45+
- --input
46+
- "{{ podman_e2e_test_root }}/openshell-e2e-python-dev.tar"
47+
environment:
48+
HOME: /home/tmachine
49+
XDG_RUNTIME_DIR: /run/user/1000
50+
51+
- name: Remove any previous OpenShell gateway registration
52+
ansible.builtin.command:
53+
argv: [/usr/local/bin/openshell, gateway, remove, tmachine]
54+
changed_when: false
55+
failed_when: false
56+
57+
- name: Register the configured OpenShell gateway
58+
ansible.builtin.command:
59+
argv: [/usr/local/bin/openshell, gateway, add, http://127.0.0.1:17670, --local, --name, tmachine]
60+
61+
- name: Run Podman E2E archive tests
62+
ansible.builtin.command:
63+
argv:
64+
- cargo-nextest
65+
- nextest
66+
- run
67+
- --archive-file
68+
- "{{ podman_e2e_test_root }}/tests.tar.zst"
69+
- --workspace-remap
70+
- "{{ podman_e2e_test_root }}"
71+
- --test-threads
72+
- "1"
73+
- --no-fail-fast
74+
environment:
75+
CONTAINER_ENGINE: podman
76+
CONTAINER_HOST: unix:///run/user/1000/podman/podman.sock
77+
HOME: /home/tmachine
78+
OPENSHELL_BIN: /usr/local/bin/openshell
79+
OPENSHELL_E2E_CONTAINER_ENGINE_UNSET_XDG_CONFIG_HOME: "1"
80+
OPENSHELL_E2E_DRIVER: podman
81+
OPENSHELL_E2E_NETWORK_NAME: tmachine
82+
OPENSHELL_E2E_SANDBOX_NAMESPACE: tmachine
83+
OPENSHELL_GATEWAY: tmachine
84+
OPENSHELL_PODMAN_SOCKET: /run/user/1000/podman/podman.sock
85+
XDG_RUNTIME_DIR: /run/user/1000
86+
register: podman_e2e_test_result
87+
changed_when: false
88+
failed_when: false
89+
90+
- name: Show Podman E2E test diagnostics
91+
ansible.builtin.debug:
92+
var: podman_e2e_test_result.stderr_lines
93+
94+
- name: Show Podman E2E test result
95+
ansible.builtin.debug:
96+
var: podman_e2e_test_result.stdout_lines
97+
98+
- name: Capture OpenShell gateway journal after Podman E2E test failure
99+
become: true
100+
ansible.builtin.command:
101+
argv: [journalctl, --unit, openshell-gateway.service, --no-pager, --lines, "200"]
102+
changed_when: false
103+
failed_when: false
104+
when: podman_e2e_test_result.rc != 0
105+
register: podman_e2e_gateway_journal
106+
107+
- name: Show OpenShell gateway journal after Podman E2E test failure
108+
ansible.builtin.debug:
109+
var: podman_e2e_gateway_journal.stdout_lines
110+
when: podman_e2e_test_result.rc != 0
111+
112+
- name: Require Podman E2E archive success
113+
ansible.builtin.assert:
114+
that: [podman_e2e_test_result.rc == 0]
115+
fail_msg: Podman E2E archive tests failed

‎tests/ansible/roles/openshell_gateway/templates/gateway-podman.toml.j2‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ sandbox_runtime_image = "docker.io/openshell/sandbox:tmachine"
99
supervisor_image = "docker.io/openshell/supervisor:tmachine"
1010
network_name = "tmachine"
1111
health_check_interval_secs = 10
12+
stop_timeout_secs = 15
1213
{% endblock %}

‎tests/artifacts.nix‎

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ let
2424
package,
2525
target,
2626
output,
27+
features ? null,
28+
filter ? "kind(test)",
2729
}:
2830
pkgs.writeShellApplication {
2931
name = "build-${name}-test-archive";
@@ -56,7 +58,8 @@ let
5658
--manifest-path "$manifest_path" \
5759
--target ${target} \
5860
-p ${package} \
59-
-E 'kind(test)' \
61+
${pkgs.lib.optionalString (features != null) "--features ${pkgs.lib.escapeShellArg features}"} \
62+
-E ${pkgs.lib.escapeShellArg filter} \
6063
--archive-file "$bundle_dir/tests.tar.zst"
6164
6265
cd "$workspace_root"
@@ -92,6 +95,54 @@ let
9295
target = muslToolchain.target;
9396
output = "artifacts/test-archives/${muslToolchain.target}/provider-refresh-keycloak-tests.tar";
9497
};
98+
99+
# Follow-up: migrate these wrapper-coupled tests once tmachine provides their
100+
# managed-gateway controls, SPIFFE fixtures, caller driver-config setting,
101+
# guest tools, and matching workload-image identity behavior. The corporate
102+
# proxy and gateway-start binaries currently self-skip without wrapper-owned
103+
# gateway metadata, so exclude them rather than report false passes.
104+
podmanE2eFollowUpBinaries = [
105+
"credential_gating"
106+
"driver_config_volume"
107+
"forward_proxy_graphql_l7"
108+
"forward_proxy_jsonrpc_l7"
109+
"forward_proxy_l7_bypass"
110+
"host_gateway_alias"
111+
"landlock"
112+
"local_driver_token_restart"
113+
# Standalone tmachine runs can time out while opening the localhost relay.
114+
# Follow up on making the relay setup deterministic before restoring it.
115+
"no_proxy"
116+
"podman_corporate_proxy"
117+
"podman_gateway_start"
118+
"podman_oci_identity"
119+
# This validates the standalone driver binary's daemon-unavailable path and
120+
# belongs in the Podman driver crate's integration tests. The E2E archive
121+
# does not contain `openshell-driver-podman`.
122+
"podman_preflight"
123+
"provider_auto_create"
124+
# The provider-refresh feature suite covers revoked Keycloak grants. This
125+
# binary instead covers stable workload handles across repeated rotations
126+
# and explicit refresh reconfiguration in a long-running sandbox.
127+
"provider_refresh_handles"
128+
"provider_token_exchange"
129+
"proxy_egress_pipeline"
130+
# Conformance covers stop/start workspace preservation and deletion while
131+
# stopped. The remaining canonical-main, TTY, attachment replay, and
132+
# no-keep cases still need migration. Nextest archive filters cannot select
133+
# individual tests, so keep the complete binary in the follow-up bucket.
134+
"sandbox_lifecycle"
135+
# Needs a prebuilt musl DNS probe in guest artifact mode; tracked in #3009.
136+
"transparent_tcp"
137+
"websocket_conformance"
138+
"workspace_lifecycle"
139+
];
140+
podmanE2eArchiveFilter =
141+
let
142+
excludedBinaries = map (binary: "binary(=${binary})") podmanE2eFollowUpBinaries;
143+
in
144+
"kind(test) and not (${pkgs.lib.concatStringsSep " or " excludedBinaries})";
145+
95146
podmanDriverArchive = mkTestArchive {
96147
name = "podman-driver";
97148
workspacePath = "tests/suites/drivers";
@@ -100,9 +151,24 @@ let
100151
target = muslToolchain.target;
101152
output = "artifacts/test-archives/${muslToolchain.target}/openshell-podman-tests.tar";
102153
};
154+
podmanE2eArchive = mkTestArchive {
155+
name = "podman-e2e";
156+
workspacePath = "e2e/rust";
157+
manifestPath = "e2e/rust/Cargo.toml";
158+
package = "openshell-e2e";
159+
target = muslToolchain.target;
160+
output = "artifacts/test-archives/${muslToolchain.target}/openshell-podman-e2e-tests.tar";
161+
features = "e2e-podman";
162+
filter = podmanE2eArchiveFilter;
163+
};
103164
in
104165
rec {
105-
inherit conformanceCliArchive providerRefreshKeycloakArchive podmanDriverArchive;
166+
inherit
167+
conformanceCliArchive
168+
providerRefreshKeycloakArchive
169+
podmanDriverArchive
170+
podmanE2eArchive
171+
;
106172

107173
binaries = pkgs.writeShellApplication {
108174
name = "build-artifacts-binaries";
@@ -148,19 +214,48 @@ rec {
148214
conformanceCliArchive
149215
providerRefreshKeycloakArchive
150216
podmanDriverArchive
217+
podmanE2eArchive
151218
];
152219
text = ''
153220
build-openshell-conformance-test-archive
154221
build-provider-refresh-keycloak-test-archive
155222
build-podman-driver-test-archive
223+
build-podman-e2e-test-archive
224+
'';
225+
};
226+
227+
testImages = pkgs.writeShellApplication {
228+
name = "build-artifacts-test-images";
229+
runtimeInputs = [
230+
pkgs.coreutils
231+
pkgs.docker-client
232+
pkgs.git
233+
];
234+
text = ''
235+
root=$(git rev-parse --show-toplevel)
236+
cd "$root"
237+
238+
docker build \
239+
--platform linux/${dockerArch} \
240+
--file e2e/python/Dockerfile.workload \
241+
--build-arg "PYTHON_VERSION=$(cat .python-version)" \
242+
--tag openshell/e2e-python:dev \
243+
e2e/python
244+
245+
mkdir -p artifacts/images
246+
docker save \
247+
--output artifacts/images/openshell-e2e-python-dev.tar \
248+
openshell/e2e-python:dev
156249
'';
157250
};
158251

159252
images = pkgs.writeShellApplication {
160253
name = "build-artifacts-images";
161254
runtimeInputs = [
255+
pkgs.coreutils
162256
pkgs.docker-client
163257
pkgs.git
258+
testImages
164259
];
165260
text = ''
166261
root=$(git rev-parse --show-toplevel)
@@ -212,6 +307,8 @@ rec {
212307
docker save \
213308
--output artifacts/images/openshell-sandbox-tmachine.tar \
214309
openshell/sandbox:tmachine
310+
311+
build-artifacts-test-images
215312
'';
216313
};
217314

‎tests/config.nix‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ let
133133
provider_refresh_keycloak_test_bundle = "../artifacts/test-archives/${muslTarget}/provider-refresh-keycloak-tests.tar";
134134
};
135135
}
136+
{
137+
name = "e2e-podman";
138+
playbooks = [ "ansible/playbooks/drivers/podman/e2e.yaml" ];
139+
inputs = {
140+
openshell_podman_e2e_test_bundle = "../artifacts/test-archives/${muslTarget}/openshell-podman-e2e-tests.tar";
141+
openshell_podman_e2e_workload_image = "../artifacts/images/openshell-e2e-python-dev.tar";
142+
};
143+
}
136144
{
137145
name = "driver-podman";
138146
playbooks = [

0 commit comments

Comments
 (0)