Skip to content

Commit b8ffe52

Browse files
test(podman): move podman_preflight into driver-podman integration tests (#3783)
* test(podman): move podman_preflight into driver-podman integration tests podman_preflight verifies that openshell-driver-podman fails fast when its Podman socket is unreachable. It only needs the standalone driver binary, not a gateway, so it never fit the gateway-backed e2e-podman harness it lived under and never ran anywhere in CI. Move it into crates/openshell-driver-podman/tests/ as a plain Cargo integration test. It now runs via the existing required workspace test job with no special mise task, workflow step, or coverage exception. Signed-off-by: politerealism <burdcat17@gmail.com> * test(podman): make preflight diagnostics portable Signed-off-by: Evan Lezar <elezar@nvidia.com> --------- Signed-off-by: politerealism <burdcat17@gmail.com> Signed-off-by: Evan Lezar <elezar@nvidia.com> Co-authored-by: Evan Lezar <elezar@nvidia.com>
1 parent b8932d4 commit b8ffe52

5 files changed

Lines changed: 19 additions & 53 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/openshell-driver-podman/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ openshell-otel-test-support = { path = "../openshell-otel-test-support" }
5151
opentelemetry_sdk = { workspace = true, features = ["testing"] }
5252
prost-types = { workspace = true }
5353
temp-env = "0.3"
54+
tempfile = "3"
5455
tokio = { workspace = true, features = ["test-util"] }
5556

5657
[lints]

e2e/rust/tests/podman_preflight.rs renamed to crates/openshell-driver-podman/tests/podman_preflight.rs

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,43 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
#![cfg(feature = "e2e-podman")]
5-
6-
//! Podman driver daemon-unavailable e2e tests.
4+
//! Podman driver daemon-unavailable integration tests.
75
//!
86
//! These tests verify that `openshell-driver-podman` fails fast with an
97
//! actionable error when it cannot reach a Podman API socket, instead of
108
//! hanging or silently serving gRPC against a dead connection.
119
//!
12-
//! The tests do NOT require a running Podman daemon or gateway — they point
10+
//! They do NOT require a running Podman daemon or gateway — they point
1311
//! `--podman-socket` at a path that is guaranteed not to exist to simulate
14-
//! the daemon being unavailable.
12+
//! the daemon being unavailable. As a plain Cargo integration test in this
13+
//! crate, this runs via the normal `cargo test -p openshell-driver-podman`
14+
//! lane with no special CI wiring: Cargo provides `CARGO_BIN_EXE_<name>` for
15+
//! this crate's own `[[bin]]` target automatically.
1516
16-
use std::path::{Path, PathBuf};
17+
use std::path::PathBuf;
1718
use std::time::{Duration, Instant};
1819

19-
use openshell_e2e::harness::output::strip_ansi;
20-
21-
/// Locate the workspace root by walking up from this crate's manifest directory.
22-
fn workspace_root() -> PathBuf {
23-
Path::new(env!("CARGO_MANIFEST_DIR"))
24-
.ancestors()
25-
.nth(2)
26-
.expect("failed to resolve workspace root from CARGO_MANIFEST_DIR")
27-
.to_path_buf()
28-
}
29-
30-
/// Return the path to the `openshell-driver-podman` binary.
31-
///
32-
/// Uses `OPENSHELL_EXTERNAL_DRIVER_BIN` when set (the same env var the shell
33-
/// e2e harness uses for prebuilt standalone driver artifacts), otherwise
34-
/// expects the binary at `<workspace>/target/debug/openshell-driver-podman`.
35-
fn driver_podman_bin() -> PathBuf {
36-
let bin = std::env::var_os("OPENSHELL_EXTERNAL_DRIVER_BIN").map_or_else(
37-
|| workspace_root().join("target/debug/openshell-driver-podman"),
38-
PathBuf::from,
39-
);
40-
assert!(
41-
bin.is_file(),
42-
"openshell-driver-podman binary not found at {} — set OPENSHELL_EXTERNAL_DRIVER_BIN \
43-
or run `cargo build -p openshell-driver-podman` first",
44-
bin.display()
45-
);
46-
bin
47-
}
48-
4920
/// Run `openshell-driver-podman` pointed at a Podman socket that does not
5021
/// exist, and wait for it to exit.
5122
///
5223
/// The driver retries a handful of times before giving up (to tolerate the
5324
/// socket briefly re-activating), so this can take several seconds.
5425
async fn run_with_unreachable_podman_socket() -> (String, i32, Duration, PathBuf) {
5526
let tmpdir = tempfile::tempdir().expect("create isolated socket dir");
56-
let missing_socket = tmpdir.path().join("openshell-e2e-nonexistent-podman.sock");
27+
// Use a short relative path so miette cannot insert a line-wrap gutter
28+
// inside it on platforms with long temporary-directory paths.
29+
let missing_socket = PathBuf::from("missing-podman.sock");
5730

5831
let start = Instant::now();
59-
let mut cmd = tokio::process::Command::new(driver_podman_bin());
32+
let mut cmd = tokio::process::Command::new(env!("CARGO_BIN_EXE_openshell-driver-podman"));
6033
cmd.arg("--podman-socket")
6134
.arg(&missing_socket)
35+
.current_dir(tmpdir.path())
6236
.kill_on_drop(true)
6337
.stdout(std::process::Stdio::piped())
6438
.stderr(std::process::Stdio::piped());
6539

66-
let output = tokio::time::timeout(Duration::from_secs(60), cmd.output())
40+
let output = tokio::time::timeout(Duration::from_mins(1), cmd.output())
6741
.await
6842
.expect("openshell-driver-podman should exit instead of hanging")
6943
.expect("spawn openshell-driver-podman");
@@ -102,15 +76,14 @@ async fn driver_error_names_unreachable_socket() {
10276
let (output, code, _, missing_socket) = run_with_unreachable_podman_socket().await;
10377

10478
assert_ne!(code, 0);
105-
let clean = strip_ansi(&output);
10679

10780
assert!(
108-
clean.contains("connection error"),
109-
"driver error should describe a connection failure:\n{clean}"
81+
output.contains("connection error"),
82+
"driver error should describe a connection failure:\n{output}"
11083
);
11184
assert!(
112-
clean.contains(missing_socket.to_str().expect("socket path is utf-8")),
113-
"driver error should name the unreachable socket path {}:\n{clean}",
85+
output.contains(missing_socket.to_str().expect("socket path is utf-8")),
86+
"driver error should name the unreachable socket path {}:\n{output}",
11487
missing_socket.display()
11588
);
11689
}

‎e2e/rust/Cargo.toml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,6 @@ name = "podman_host_gateway"
103103
path = "tests/podman_host_gateway.rs"
104104
required-features = ["e2e-podman"]
105105

106-
[[test]]
107-
name = "podman_preflight"
108-
path = "tests/podman_preflight.rs"
109-
required-features = ["e2e-podman"]
110-
111106
[[test]]
112107
name = "podman_corporate_proxy"
113108
path = "tests/podman_corporate_proxy.rs"

‎tests/artifacts.nix‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ let
116116
"podman_corporate_proxy"
117117
"podman_gateway_start"
118118
"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"
123119
"provider_auto_create"
124120
# The provider-refresh feature suite covers revoked Keycloak grants. This
125121
# binary instead covers stable workload handles across repeated rotations

0 commit comments

Comments
 (0)