[core] Phase 1: core, edge and differential tests #2
@@ -10,18 +10,32 @@
|
|||||||
//!
|
//!
|
||||||
//! 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;
|
||||||
|
|
||||||
|
#[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!()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
mod unix {
|
||||||
|
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use common::{EdgeSpec, host_file, spawn};
|
use crate::common::{EdgeSpec, host_file, spawn};
|
||||||
use ianitor_testkit::client::{self, Req};
|
use ianitor_testkit::client::{self, Req};
|
||||||
use ianitor_testkit::proc::{ChildGuard, TempDir, free_port, local, require_binary, wait_for_port};
|
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::tls::{TestCa, roots_from_pem};
|
||||||
use ianitor_testkit::upstream::Echo;
|
use ianitor_testkit::upstream::Echo;
|
||||||
|
|
||||||
@@ -216,3 +230,4 @@ async fn certificate_is_obtained_from_pebble_and_served() {
|
|||||||
"no key material in the log"
|
"no key material in the log"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,12 +6,24 @@
|
|||||||
//! 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))]
|
||||||
|
#[test]
|
||||||
|
fn skipped_on_windows() {
|
||||||
|
eprintln!(
|
||||||
|
"SKIPPED on Windows: {} needs Linux (Pingora runner, Caddy, Pebble); run it in WSL2, see CLAUDE.md",
|
||||||
|
file!()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
mod unix {
|
||||||
|
|
||||||
|
use crate::common::{EdgeSpec, host_file, start};
|
||||||
use ianitor_testkit::authelia::MockAuthelia;
|
use ianitor_testkit::authelia::MockAuthelia;
|
||||||
use ianitor_testkit::client::{self, Req, WsOutcome};
|
use ianitor_testkit::client::{self, Req, WsOutcome};
|
||||||
use ianitor_testkit::upstream::{Echo, WsEcho, closed_port};
|
use ianitor_testkit::upstream::{Echo, WsEcho, closed_port};
|
||||||
@@ -374,3 +386,4 @@ async fn remote_headers_are_stripped_even_with_a_custom_copy_list() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,12 +5,24 @@
|
|||||||
//! 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))]
|
||||||
|
#[test]
|
||||||
|
fn skipped_on_windows() {
|
||||||
|
eprintln!(
|
||||||
|
"SKIPPED on Windows: {} needs Linux (Pingora runner, Caddy, Pebble); run it in WSL2, see CLAUDE.md",
|
||||||
|
file!()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
mod unix {
|
||||||
|
|
||||||
|
use crate::common::{EdgeSpec, host_file, spawn, start};
|
||||||
use ianitor_testkit::client::{self, Req, Resp, WsOutcome};
|
use ianitor_testkit::client::{self, Req, Resp, WsOutcome};
|
||||||
use ianitor_testkit::upstream::{Echo, WsEcho, closed_port};
|
use ianitor_testkit::upstream::{Echo, WsEcho, closed_port};
|
||||||
|
|
||||||
@@ -249,7 +261,7 @@ async fn malformed_secret_is_rejected_without_echoing_it() {
|
|||||||
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;
|
||||||
@@ -258,3 +270,4 @@ fn wait_exit(edge: &mut common::Edge) -> std::process::ExitStatus {
|
|||||||
}
|
}
|
||||||
panic!("edge kept running:\n{}", edge.stderr());
|
panic!("edge kept running:\n{}", edge.stderr());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,14 +5,26 @@
|
|||||||
//! 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;
|
||||||
|
|
||||||
|
#[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!()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
mod unix {
|
||||||
|
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use common::{EdgeSpec, host_file, start};
|
use crate::common::{EdgeSpec, host_file, start};
|
||||||
use ianitor_testkit::client::{self, Req};
|
use ianitor_testkit::client::{self, Req};
|
||||||
use ianitor_testkit::raw::{RawServer, Reply, response};
|
use ianitor_testkit::raw::{RawServer, Reply, response};
|
||||||
use ianitor_testkit::upstream::Echo;
|
use ianitor_testkit::upstream::Echo;
|
||||||
@@ -186,3 +198,4 @@ async fn absolute_form_requests_are_answered() {
|
|||||||
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());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,11 +5,22 @@
|
|||||||
//! 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)]
|
||||||
|
|
||||||
|
#[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!()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
mod unix {
|
||||||
use ianitor_diff::{
|
use ianitor_diff::{
|
||||||
Env, break_caddy, break_edge, compile_pair, corpus, run_corpus, settle, start_caddy, start_edge,
|
Env, break_caddy, break_edge, compile_pair, corpus, run_corpus, settle, start_caddy,
|
||||||
|
start_edge,
|
||||||
};
|
};
|
||||||
use ianitor_testkit::proc::require_binary;
|
use ianitor_testkit::proc::require_binary;
|
||||||
|
|
||||||
@@ -87,3 +98,4 @@ async fn a_deliberately_broken_compiler_is_caught() {
|
|||||||
"{diff2:?}"
|
"{diff2:?}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user