Skip to content

Commit 31e7182

Browse files
test(conformance): require the fail-closed middleware's 403 and match the finding name
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
1 parent 2e1cf38 commit 31e7182

1 file changed

Lines changed: 2 additions & 16 deletions

File tree

‎tests/suites/conformance/src/network_egress.rs‎

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -230,28 +230,14 @@ async fn fail_closed_middleware_blocks_uninspectable_traffic(cx: &mut Context) -
230230
let mut payload = vec![0x00, 0xff, 0x13, 0x37];
231231
payload.extend_from_slice(b"not-http-or-tls");
232232
let reply = http_raw(&sandbox, TEST_HOST, server.port, &payload).await?;
233-
let denial = reply.received_text();
234233
testkit::ensure!(
235-
reply.connect.is_connected()
236-
&& (denial.is_empty()
237-
|| denial.contains("HTTP/1.1 403 Forbidden")
238-
&& denial.contains("unsupported_l7_protocol")),
234+
reply.status() == Some(403)
235+
&& crate::network_l7::error_code(&reply).as_deref() == Some("unsupported_l7_protocol"),
239236
"expected the middleware to block the payload: {reply:?}"
240237
);
241-
// Give a forwarded payload time to arrive before checking it didn't.
242-
tokio::time::sleep(Duration::from_millis(200)).await;
243-
let received = server.received();
244-
testkit::ensure!(
245-
received.is_empty(),
246-
"the payload reached upstream: {:?}",
247-
String::from_utf8_lossy(&received)
248-
);
249238
sandbox
250239
.logs_until("the middleware denial", |logs| {
251240
logs.contains("openshell.middleware.traffic_uninspectable")
252-
&& logs.contains(
253-
"Unsupported tunnel protocol cannot be inspected by required middleware",
254-
)
255241
})
256242
.await?;
257243
Ok(())

0 commit comments

Comments
 (0)