[core] Phase 1: core, edge and differential tests #2
@@ -10,23 +10,37 @@
|
|||||||
//!
|
//!
|
||||||
//! This is not Let's Encrypt staging: that needs a public domain and DNS.
|
//! This is not Let's Encrypt staging: that needs a public domain and DNS.
|
||||||
|
|
||||||
#![cfg(unix)]
|
|
||||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use std::os::unix::fs::PermissionsExt;
|
#[cfg(not(unix))]
|
||||||
use std::process::{Command, Stdio};
|
#[test]
|
||||||
use std::time::{Duration, Instant};
|
fn skipped_on_windows() {
|
||||||
|
eprintln!(
|
||||||
|
"SKIPPED on Windows: {} needs Linux (Pingora runner, Caddy, Pebble); run it in WSL2, see CLAUDE.md",
|
||||||
|
file!()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
use common::{EdgeSpec, host_file, spawn};
|
#[cfg(unix)]
|
||||||
use ianitor_testkit::client::{self, Req};
|
mod unix {
|
||||||
use ianitor_testkit::proc::{ChildGuard, TempDir, free_port, local, require_binary, wait_for_port};
|
|
||||||
use ianitor_testkit::tls::{TestCa, roots_from_pem};
|
|
||||||
use ianitor_testkit::upstream::Echo;
|
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
use std::os::unix::fs::PermissionsExt;
|
||||||
async fn certificate_is_obtained_from_pebble_and_served() {
|
use std::process::{Command, Stdio};
|
||||||
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
|
use crate::common::{EdgeSpec, host_file, spawn};
|
||||||
|
use ianitor_testkit::client::{self, Req};
|
||||||
|
use ianitor_testkit::proc::{
|
||||||
|
ChildGuard, TempDir, free_port, local, require_binary, wait_for_port,
|
||||||
|
};
|
||||||
|
use ianitor_testkit::tls::{TestCa, roots_from_pem};
|
||||||
|
use ianitor_testkit::upstream::Echo;
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn certificate_is_obtained_from_pebble_and_served() {
|
||||||
let (Some(pebble), Some(challtestsrv)) = (
|
let (Some(pebble), Some(challtestsrv)) = (
|
||||||
require_binary("pebble"),
|
require_binary("pebble"),
|
||||||
require_binary("pebble-challtestsrv"),
|
require_binary("pebble-challtestsrv"),
|
||||||
@@ -215,4 +229,5 @@ async fn certificate_is_obtained_from_pebble_and_served() {
|
|||||||
!edge.stderr().contains("PRIVATE KEY"),
|
!edge.stderr().contains("PRIVATE KEY"),
|
||||||
"no key material in the log"
|
"no key material in the log"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,22 +6,34 @@
|
|||||||
//! goes back to the client unchanged, and an allowed request carries the identity headers
|
//! goes back to the client unchanged, and an allowed request carries the identity headers
|
||||||
//! from the auth server and never the client's own.
|
//! from the auth server and never the client's own.
|
||||||
|
|
||||||
#![cfg(unix)]
|
|
||||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use common::{EdgeSpec, host_file, start};
|
#[cfg(not(unix))]
|
||||||
use ianitor_testkit::authelia::MockAuthelia;
|
#[test]
|
||||||
use ianitor_testkit::client::{self, Req, WsOutcome};
|
fn skipped_on_windows() {
|
||||||
use ianitor_testkit::upstream::{Echo, WsEcho, closed_port};
|
eprintln!(
|
||||||
|
"SKIPPED on Windows: {} needs Linux (Pingora runner, Caddy, Pebble); run it in WSL2, see CLAUDE.md",
|
||||||
fn site(auth_url: &str) -> String {
|
file!()
|
||||||
format!("[forward_auth]\nurl = \"{auth_url}\"\n")
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[cfg(unix)]
|
||||||
async fn denial_never_reaches_the_upstream() {
|
mod unix {
|
||||||
|
|
||||||
|
use crate::common::{EdgeSpec, host_file, start};
|
||||||
|
use ianitor_testkit::authelia::MockAuthelia;
|
||||||
|
use ianitor_testkit::client::{self, Req, WsOutcome};
|
||||||
|
use ianitor_testkit::upstream::{Echo, WsEcho, closed_port};
|
||||||
|
|
||||||
|
fn site(auth_url: &str) -> String {
|
||||||
|
format!("[forward_auth]\nurl = \"{auth_url}\"\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn denial_never_reaches_the_upstream() {
|
||||||
let authelia = MockAuthelia::start().await;
|
let authelia = MockAuthelia::start().await;
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
let ws = WsEcho::start().await;
|
let ws = WsEcho::start().await;
|
||||||
@@ -148,10 +160,10 @@ async fn denial_never_reaches_the_upstream() {
|
|||||||
post.body.is_empty(),
|
post.body.is_empty(),
|
||||||
"the request body is not sent to the auth server"
|
"the request body is not sent to the auth server"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn allowed_request_carries_identity_from_the_auth_server_only() {
|
async fn allowed_request_carries_identity_from_the_auth_server_only() {
|
||||||
let authelia = MockAuthelia::start().await;
|
let authelia = MockAuthelia::start().await;
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
let site = site(&authelia.url());
|
let site = site(&authelia.url());
|
||||||
@@ -224,10 +236,10 @@ async fn allowed_request_carries_identity_from_the_auth_server_only() {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(r.status, 200);
|
assert_eq!(r.status, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn unreachable_auth_server_fails_closed() {
|
async fn unreachable_auth_server_fails_closed() {
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
let site = site(&format!(
|
let site = site(&format!(
|
||||||
"http://127.0.0.1:{}/api/authz/forward-auth",
|
"http://127.0.0.1:{}/api/authz/forward-auth",
|
||||||
@@ -254,11 +266,11 @@ async fn unreachable_auth_server_fails_closed() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(r.status, 502);
|
assert_eq!(r.status, 502);
|
||||||
assert!(echo.proxied().is_empty());
|
assert!(echo.proxied().is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// QC B2a, B2b, m3: misbehaving auth servers. Edge fails closed and never crashes or hangs.
|
/// QC B2a, B2b, m3: misbehaving auth servers. Edge fails closed and never crashes or hangs.
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn misbehaving_auth_answers_fail_closed() {
|
async fn misbehaving_auth_answers_fail_closed() {
|
||||||
let authelia = MockAuthelia::start().await;
|
let authelia = MockAuthelia::start().await;
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
let site = site(&authelia.url());
|
let site = site(&authelia.url());
|
||||||
@@ -323,12 +335,12 @@ async fn misbehaving_auth_answers_fail_closed() {
|
|||||||
|
|
||||||
// Still serving afterwards.
|
// Still serving afterwards.
|
||||||
assert_eq!(go("good").await.unwrap().status, 200);
|
assert_eq!(go("good").await.unwrap().status, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// QC m5: client-sent Remote-* headers never reach a forward-auth upstream, whatever
|
/// QC m5: client-sent Remote-* headers never reach a forward-auth upstream, whatever
|
||||||
/// copy_headers says.
|
/// copy_headers says.
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn remote_headers_are_stripped_even_with_a_custom_copy_list() {
|
async fn remote_headers_are_stripped_even_with_a_custom_copy_list() {
|
||||||
let authelia = MockAuthelia::start().await;
|
let authelia = MockAuthelia::start().await;
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
for copy in ["[]", "[\"Remote-User\"]"] {
|
for copy in ["[]", "[\"Remote-User\"]"] {
|
||||||
@@ -373,4 +385,5 @@ async fn remote_headers_are_stripped_even_with_a_custom_copy_list() {
|
|||||||
assert_eq!(up.header(h), None, "{h} with copy_headers = {copy}");
|
assert_eq!(up.header(h), None, "{h} with copy_headers = {copy}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,29 +5,41 @@
|
|||||||
//! An injected secret reaches the upstream and never appears in a response, a log line, the
|
//! An injected secret reaches the upstream and never appears in a response, a log line, the
|
||||||
//! access log or the compiled config, even with the most verbose log level.
|
//! access log or the compiled config, even with the most verbose log level.
|
||||||
|
|
||||||
#![cfg(unix)]
|
|
||||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use common::{EdgeSpec, host_file, spawn, start};
|
#[cfg(not(unix))]
|
||||||
use ianitor_testkit::client::{self, Req, Resp, WsOutcome};
|
#[test]
|
||||||
use ianitor_testkit::upstream::{Echo, WsEcho, closed_port};
|
fn skipped_on_windows() {
|
||||||
|
eprintln!(
|
||||||
|
"SKIPPED on Windows: {} needs Linux (Pingora runner, Caddy, Pebble); run it in WSL2, see CLAUDE.md",
|
||||||
|
file!()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn unique_secret() -> String {
|
#[cfg(unix)]
|
||||||
|
mod unix {
|
||||||
|
|
||||||
|
use crate::common::{EdgeSpec, host_file, spawn, start};
|
||||||
|
use ianitor_testkit::client::{self, Req, Resp, WsOutcome};
|
||||||
|
use ianitor_testkit::upstream::{Echo, WsEcho, closed_port};
|
||||||
|
|
||||||
|
fn unique_secret() -> String {
|
||||||
let nanos = std::time::SystemTime::now()
|
let nanos = std::time::SystemTime::now()
|
||||||
.duration_since(std::time::UNIX_EPOCH)
|
.duration_since(std::time::UNIX_EPOCH)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.as_nanos();
|
.as_nanos();
|
||||||
format!("sekret-{}-{nanos:x}-tail", std::process::id())
|
format!("sekret-{}-{nanos:x}-tail", std::process::id())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_clean(what: &str, haystack: &[u8], secret: &str) {
|
fn assert_clean(what: &str, haystack: &[u8], secret: &str) {
|
||||||
let hay = String::from_utf8_lossy(haystack);
|
let hay = String::from_utf8_lossy(haystack);
|
||||||
assert!(!hay.contains(secret), "secret leaked into {what}:\n{hay}");
|
assert!(!hay.contains(secret), "secret leaked into {what}:\n{hay}");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_resp_clean(what: &str, r: &Resp, secret: &str) {
|
fn assert_resp_clean(what: &str, r: &Resp, secret: &str) {
|
||||||
for (n, v) in &r.headers {
|
for (n, v) in &r.headers {
|
||||||
assert_clean(
|
assert_clean(
|
||||||
&format!("{what}: response header {n}"),
|
&format!("{what}: response header {n}"),
|
||||||
@@ -36,10 +48,10 @@ fn assert_resp_clean(what: &str, r: &Resp, secret: &str) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
assert_clean(&format!("{what}: response body"), &r.body, secret);
|
assert_clean(&format!("{what}: response body"), &r.body, secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn injected_secret_never_appears_in_a_response_or_log() {
|
async fn injected_secret_never_appears_in_a_response_or_log() {
|
||||||
let secret = unique_secret();
|
let secret = unique_secret();
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
let ws = WsEcho::start().await;
|
let ws = WsEcho::start().await;
|
||||||
@@ -193,10 +205,10 @@ async fn injected_secret_never_appears_in_a_response_or_log() {
|
|||||||
assert_clean("stderr (trace level)", stderr.as_bytes(), &secret);
|
assert_clean("stderr (trace level)", stderr.as_bytes(), &secret);
|
||||||
assert_clean("access log", access.as_bytes(), &secret);
|
assert_clean("access log", access.as_bytes(), &secret);
|
||||||
assert_clean("compiled edge config", edge.config_text.as_bytes(), &secret);
|
assert_clean("compiled edge config", edge.config_text.as_bytes(), &secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn missing_secret_stops_startup_without_leaking_others() {
|
async fn missing_secret_stops_startup_without_leaking_others() {
|
||||||
let secret = unique_secret();
|
let secret = unique_secret();
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
let mut edge = spawn(EdgeSpec {
|
let mut edge = spawn(EdgeSpec {
|
||||||
@@ -218,10 +230,10 @@ async fn missing_secret_stops_startup_without_leaking_others() {
|
|||||||
let err = edge.stderr();
|
let err = edge.stderr();
|
||||||
assert!(err.contains("absent"), "names the missing secret:\n{err}");
|
assert!(err.contains("absent"), "names the missing secret:\n{err}");
|
||||||
assert_clean("stderr", err.as_bytes(), &secret);
|
assert_clean("stderr", err.as_bytes(), &secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn malformed_secret_is_rejected_without_echoing_it() {
|
async fn malformed_secret_is_rejected_without_echoing_it() {
|
||||||
let secret = unique_secret();
|
let secret = unique_secret();
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
let mut edge = spawn(EdgeSpec {
|
let mut edge = spawn(EdgeSpec {
|
||||||
@@ -247,9 +259,9 @@ async fn malformed_secret_is_rejected_without_echoing_it() {
|
|||||||
"edge must refuse a secret that is not a valid header value"
|
"edge must refuse a secret that is not a valid header value"
|
||||||
);
|
);
|
||||||
assert_clean("stderr", edge.stderr().as_bytes(), &secret);
|
assert_clean("stderr", edge.stderr().as_bytes(), &secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_exit(edge: &mut common::Edge) -> std::process::ExitStatus {
|
fn wait_exit(edge: &mut crate::common::Edge) -> std::process::ExitStatus {
|
||||||
for _ in 0..200 {
|
for _ in 0..200 {
|
||||||
if let Some(s) = edge.exited() {
|
if let Some(s) = edge.exited() {
|
||||||
return s;
|
return s;
|
||||||
@@ -257,4 +269,5 @@ fn wait_exit(edge: &mut common::Edge) -> std::process::ExitStatus {
|
|||||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||||
}
|
}
|
||||||
panic!("edge kept running:\n{}", edge.stderr());
|
panic!("edge kept running:\n{}", edge.stderr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,21 +5,33 @@
|
|||||||
//! Upstream handling: name resolution at connect time, health checks that survive odd
|
//! Upstream handling: name resolution at connect time, health checks that survive odd
|
||||||
//! answers, websocket refusal on every Upgrade token, absolute-form requests.
|
//! answers, websocket refusal on every Upgrade token, absolute-form requests.
|
||||||
|
|
||||||
#![cfg(unix)]
|
|
||||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use std::time::{Duration, Instant};
|
#[cfg(not(unix))]
|
||||||
|
#[test]
|
||||||
|
fn skipped_on_windows() {
|
||||||
|
eprintln!(
|
||||||
|
"SKIPPED on Windows: {} needs Linux (Pingora runner, Caddy, Pebble); run it in WSL2, see CLAUDE.md",
|
||||||
|
file!()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
use common::{EdgeSpec, host_file, start};
|
#[cfg(unix)]
|
||||||
use ianitor_testkit::client::{self, Req};
|
mod unix {
|
||||||
use ianitor_testkit::raw::{RawServer, Reply, response};
|
|
||||||
use ianitor_testkit::upstream::Echo;
|
|
||||||
|
|
||||||
/// QC M1: `localhost` may resolve to ::1 first while the service listens on 127.0.0.1 only.
|
use std::time::{Duration, Instant};
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
|
||||||
async fn upstream_names_are_resolved_at_connect_time_trying_every_address() {
|
use crate::common::{EdgeSpec, host_file, start};
|
||||||
|
use ianitor_testkit::client::{self, Req};
|
||||||
|
use ianitor_testkit::raw::{RawServer, Reply, response};
|
||||||
|
use ianitor_testkit::upstream::Echo;
|
||||||
|
|
||||||
|
/// QC M1: `localhost` may resolve to ::1 first while the service listens on 127.0.0.1 only.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn upstream_names_are_resolved_at_connect_time_trying_every_address() {
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
let edge = start(EdgeSpec {
|
let edge = start(EdgeSpec {
|
||||||
hosts: vec![
|
hosts: vec![
|
||||||
@@ -53,11 +65,11 @@ async fn upstream_names_are_resolved_at_connect_time_trying_every_address() {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(r.status, 502);
|
assert_eq!(r.status, 502);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// QC B2a: a health endpoint that sends a 1xx must not kill health checking.
|
/// QC B2a: a health endpoint that sends a 1xx must not kill health checking.
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn health_checks_survive_informational_answers() {
|
async fn health_checks_survive_informational_answers() {
|
||||||
let started = Instant::now();
|
let started = Instant::now();
|
||||||
let up = RawServer::start(move |req| {
|
let up = RawServer::start(move |req| {
|
||||||
if req.path == "/healthz" && started.elapsed() < Duration::from_secs(3) {
|
if req.path == "/healthz" && started.elapsed() < Duration::from_secs(3) {
|
||||||
@@ -101,11 +113,11 @@ async fn health_checks_survive_informational_answers() {
|
|||||||
.count()
|
.count()
|
||||||
>= 4
|
>= 4
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// QC m4: every Upgrade header and every comma-separated token counts.
|
/// QC m4: every Upgrade header and every comma-separated token counts.
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn websocket_refusal_checks_every_upgrade_token() {
|
async fn websocket_refusal_checks_every_upgrade_token() {
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
let edge = start(EdgeSpec {
|
let edge = start(EdgeSpec {
|
||||||
hosts: vec![host_file(
|
hosts: vec![host_file(
|
||||||
@@ -133,13 +145,13 @@ async fn websocket_refusal_checks_every_upgrade_token() {
|
|||||||
assert_eq!(r.status, 403, "{req:?}");
|
assert_eq!(r.status, 403, "{req:?}");
|
||||||
}
|
}
|
||||||
assert!(echo.proxied().is_empty());
|
assert!(echo.proxied().is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// QC nit: absolute-form request targets are answered, never dropped. Pingora refuses a target
|
/// QC nit: absolute-form request targets are answered, never dropped. Pingora refuses a target
|
||||||
/// whose authority differs from Host (400, on both listeners); a consistent one is routed and
|
/// whose authority differs from Host (400, on both listeners); a consistent one is routed and
|
||||||
/// sent upstream in origin form.
|
/// sent upstream in origin form.
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn absolute_form_requests_are_answered() {
|
async fn absolute_form_requests_are_answered() {
|
||||||
let echo = Echo::start("app").await;
|
let echo = Echo::start("app").await;
|
||||||
let edge = start(EdgeSpec {
|
let edge = start(EdgeSpec {
|
||||||
hosts: vec![host_file(
|
hosts: vec![host_file(
|
||||||
@@ -185,4 +197,5 @@ async fn absolute_form_requests_are_answered() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(r.status, 200);
|
assert_eq!(r.status, 200);
|
||||||
assert!(r.text().contains("\"path\":\"/abs\""), "{}", r.text());
|
assert!(r.text().contains("\"path\":\"/abs\""), "{}", r.text());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-10
@@ -5,16 +5,27 @@
|
|||||||
//! The differential suite (ROADMAP §5 layer 1). Needs the `caddy` binary on PATH (or
|
//! The differential suite (ROADMAP §5 layer 1). Needs the `caddy` binary on PATH (or
|
||||||
//! `$IANITOR_CADDY_BIN`); without it the tests fail unless `IANITOR_ALLOW_SKIP=1`.
|
//! `$IANITOR_CADDY_BIN`); without it the tests fail unless `IANITOR_ALLOW_SKIP=1`.
|
||||||
|
|
||||||
#![cfg(unix)]
|
|
||||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||||
|
|
||||||
use ianitor_diff::{
|
#[cfg(not(unix))]
|
||||||
Env, break_caddy, break_edge, compile_pair, corpus, run_corpus, settle, start_caddy, start_edge,
|
#[test]
|
||||||
};
|
fn skipped_on_windows() {
|
||||||
use ianitor_testkit::proc::require_binary;
|
eprintln!(
|
||||||
|
"SKIPPED on Windows: {} needs Linux (Pingora runner, Caddy, Pebble); run it in WSL2, see CLAUDE.md",
|
||||||
|
file!()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
|
#[cfg(unix)]
|
||||||
async fn ianitor_and_caddy_answer_the_corpus_identically() {
|
mod unix {
|
||||||
|
use ianitor_diff::{
|
||||||
|
Env, break_caddy, break_edge, compile_pair, corpus, run_corpus, settle, start_caddy,
|
||||||
|
start_edge,
|
||||||
|
};
|
||||||
|
use ianitor_testkit::proc::require_binary;
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
|
||||||
|
async fn ianitor_and_caddy_answer_the_corpus_identically() {
|
||||||
let Some(caddy_bin) = require_binary("caddy") else {
|
let Some(caddy_bin) = require_binary("caddy") else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -48,10 +59,10 @@ async fn ianitor_and_caddy_answer_the_corpus_identically() {
|
|||||||
"corpus covers status {wanted}: {statuses:?}"
|
"corpus covers status {wanted}: {statuses:?}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
|
||||||
async fn a_deliberately_broken_compiler_is_caught() {
|
async fn a_deliberately_broken_compiler_is_caught() {
|
||||||
let Some(caddy_bin) = require_binary("caddy") else {
|
let Some(caddy_bin) = require_binary("caddy") else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -86,4 +97,5 @@ async fn a_deliberately_broken_compiler_is_caught() {
|
|||||||
diff2.contains(&"secret header cannot be preset"),
|
diff2.contains(&"secret header cannot be preset"),
|
||||||
"{diff2:?}"
|
"{diff2:?}"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user