Skip to content

Commit 7933fb4

Browse files
committed
test(e2e): make the edge tunnel test failure visible
ws_tunnel_status_through_edge_proxy returned early, and so reported success, whenever it could not set up its own preconditions. It could not in any lane that runs today: - It looks for the gateway URL on a `gateway info` line that mentions "endpoint" or "gateway", but the URL is printed on the `Server:` line. - It requires a plaintext endpoint, but the lanes that start their own gateway register an mTLS gateway at an https:// endpoint. Ignore the test with the reason documented, and turn the early returns into failures so a run with --ignored cannot pass without exercising the tunnel. Contributes to #3712 Signed-off-by: politerealism <burdcat17@gmail.com>
1 parent 6a6401b commit 7933fb4

1 file changed

Lines changed: 36 additions & 21 deletions

File tree

‎e2e/rust/tests/edge_tunnel_e2e.rs‎

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,40 @@ async fn gateway_status_reports_healthy() {
139139
///
140140
/// Note: The dummy token won't be validated (no edge auth middleware on
141141
/// the plaintext gateway), but it triggers the CLI's tunnel proxy codepath.
142+
///
143+
/// Disabled by default. This test used to return early, and so report success,
144+
/// whenever it could not set up its own preconditions. It could not in any
145+
/// lane that runs today, so it never exercised the tunnel:
146+
///
147+
/// 1. The endpoint lookup scans `gateway info` for a line that mentions
148+
/// "endpoint" or "gateway" and also carries a URL. The URL is printed on the
149+
/// `Server:` line, which matches neither word, so no endpoint is found.
150+
/// 2. The test requires a plaintext `http://` endpoint, but the lanes that
151+
/// start their own gateway (`with-docker-gateway.sh`,
152+
/// `with-podman-gateway.sh`) register an mTLS gateway at
153+
/// `https://127.0.0.1:<port>`. Only the "existing endpoint" mode, where
154+
/// `OPENSHELL_GATEWAY_ENDPOINT` is a plaintext `http://` URL, registers a
155+
/// plaintext gateway.
156+
///
157+
/// The early returns are now failures so that running it with `--ignored`
158+
/// cannot pass without testing anything. Re-enable it once it can reach a
159+
/// gateway over TLS. See
160+
/// <https://github.com/NVIDIA/OpenShell/issues/3712> for the Podman coverage
161+
/// work.
162+
#[ignore = "never reached the tunnel: endpoint lookup misses the `Server:` line and gateways use TLS (see doc comment)"]
142163
#[tokio::test]
143164
async fn ws_tunnel_status_through_edge_proxy() {
144165
let (original_status, _) = run_cli(&["status"]).await;
145166
let clean_status = strip_ansi(&original_status);
146167

147-
// Only run this test if we have a healthy gateway to test against.
148-
if !clean_status.to_lowercase().contains("healthy")
149-
&& !clean_status.to_lowercase().contains("running")
150-
&& !clean_status.to_lowercase().contains("connected")
151-
&& !clean_status.contains("✓")
152-
{
153-
eprintln!("Skipping ws_tunnel test: no healthy gateway available");
154-
return;
155-
}
168+
// This test needs a healthy gateway to test against.
169+
assert!(
170+
clean_status.to_lowercase().contains("healthy")
171+
|| clean_status.to_lowercase().contains("running")
172+
|| clean_status.to_lowercase().contains("connected")
173+
|| clean_status.contains("✓"),
174+
"ws_tunnel test needs a healthy gateway:\n{clean_status}"
175+
);
156176

157177
// Get the gateway endpoint from the gateway metadata.
158178
let (info_output, info_code) = run_cli(&["gateway", "info"]).await;
@@ -174,22 +194,17 @@ async fn ws_tunnel_status_through_edge_proxy() {
174194
});
175195

176196
let Some(endpoint) = endpoint else {
177-
eprintln!(
178-
"Skipping ws_tunnel test: could not extract gateway endpoint from:\n{info_clean}"
179-
);
180-
return;
197+
panic!("ws_tunnel test could not extract gateway endpoint from:\n{info_clean}");
181198
};
182199

183200
// For the WS tunnel test, we need the endpoint to be HTTP (plaintext).
184201
// If it's HTTPS, the WS tunnel test requires TLS negotiation which
185-
// complicates things. Skip if the gateway isn't plaintext.
186-
if !endpoint.starts_with("http://") {
187-
eprintln!(
188-
"Skipping ws_tunnel test: gateway endpoint is not plaintext HTTP: {endpoint}\n\
189-
Use a plaintext local gateway such as `mise run gateway:docker` for this test."
190-
);
191-
return;
192-
}
202+
// complicates things.
203+
assert!(
204+
endpoint.starts_with("http://"),
205+
"ws_tunnel test needs a plaintext HTTP gateway endpoint, got: {endpoint}\n\
206+
Use a plaintext local gateway such as `mise run gateway:docker` for this test."
207+
);
193208

194209
// Seed a temporary config directory with edge auth metadata pointing at
195210
// the live gateway. The dummy token triggers the WS tunnel codepath

0 commit comments

Comments
 (0)