Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions public/favicon.svg

This file was deleted.

3 changes: 1 addition & 2 deletions src/api/admin/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,7 @@ impl AdminAuth {
AdminRouteFamilyAccess::Explicit(values) => values.iter().all(|value| {
value
.parse::<u32>()
.ok()
.is_some_and(|family| provisioned.contains(&family))
.is_ok_and(|family| provisioned.contains(&family))
}),
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/api/handlers/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,10 @@ mod tests {
// Act
let close_reason = websocket_close_reason(&result);

// Assert
assert_eq!(reason, "session frame error: Backpressure(Control)");
// Assert: a non-timeout session error maps to CloseReason::Error (not
// Timeout/ClientClose), and the close carries the same reason that was
// produced — not a fixed string, since the reason text is itself derived
// from the SessionError and may evolve.
assert!(matches!(
close_reason,
CloseReason::Error(message) if message == reason
Expand Down
46 changes: 28 additions & 18 deletions src/api/ingress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,26 +174,36 @@ mod tests {

#[test]
fn should_display_ingress_errors() {
// Arrange
let errors = vec![
// Arrange / Act / Assert: each variant's Display impl must actually
// surface its structured data, not just a static label — this is
// what operators and clients see in logs/error responses.
let frame_too_large = format!(
"{}",
IngressError::FrameTooLarge {
size: 2048,
max: 1024,
},
IngressError::TooManyConnections,
IngressError::BackpressureFull,
IngressError::SessionNotFound(123),
IngressError::InvalidFrame("missing length prefix".to_string()),
IngressError::TransportError("connection reset".to_string()),
];

// Act
let mut outputs: Vec<String> = Vec::new();
for error in errors {
outputs.push(format!("{error}"));
}

// Assert
assert_eq!(outputs.len(), 6);
}
);
assert!(frame_too_large.contains("2048"));
assert!(frame_too_large.contains("1024"));
assert!(format!("{}", IngressError::SessionNotFound(123)).contains("123"));
assert!(format!(
"{}",
IngressError::InvalidFrame("missing length prefix".to_string())
)
.contains("missing length prefix"));
assert!(format!(
"{}",
IngressError::TransportError("connection reset".to_string())
)
.contains("connection reset"));

// Variants with no embedded data should still format to something
// non-empty and distinct from one another.
let too_many = format!("{}", IngressError::TooManyConnections);
let backpressure = format!("{}", IngressError::BackpressureFull);
assert!(!too_many.is_empty());
assert!(!backpressure.is_empty());
assert_ne!(too_many, backpressure);
}
}
27 changes: 15 additions & 12 deletions src/api/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,30 +293,33 @@ mod tests {

#[test]
fn should_encode_length_prefix() {
// Arrange
let data = [1, 2, 3, 4, 5];
let len = u32::try_from(data.len()).expect("test frame length fits in u32");
// Arrange: a real length-prefixed frame buffer as `frame_len` expects
// to receive it off the wire (4-byte big-endian length + payload).
let data = [1u8, 2, 3, 4, 5];
let mut buffer = BytesMut::new();
let encoded_len = u32::try_from(data.len()).expect("test frame length should fit in u32");
buffer.extend_from_slice(&encoded_len.to_be_bytes());
buffer.extend_from_slice(&data);

// Act
let len_bytes = len.to_be_bytes();
let reconstructed =
usize::try_from(u32::from_be_bytes(len_bytes)).expect("u32 length fits in usize");
let decoded_len = frame_len(&buffer);

// Assert
assert_eq!(reconstructed, 5);
assert_eq!(decoded_len, 5);
}

#[test]
fn should_handle_large_frames() {
// Arrange
let large_len: i32 = 1024 * 1024; // 1 MB
let large_len: u32 = 1024 * 1024; // 1 MB
let mut buffer = BytesMut::new();
buffer.extend_from_slice(&large_len.to_be_bytes());
buffer.extend_from_slice(&[0u8; 4]); // frame_len only reads the prefix

// Act
let len_bytes = large_len.cast_unsigned().to_be_bytes();
let reconstructed =
usize::try_from(u32::from_be_bytes(len_bytes)).expect("u32 length fits in usize");
let decoded_len = frame_len(&buffer);

// Assert
assert_eq!(reconstructed, 1024 * 1024);
assert_eq!(decoded_len, 1024 * 1024);
}
}
5 changes: 0 additions & 5 deletions src/boot/domains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,6 @@ mod tests {
panic!("{domain} actor did not fail closed: {snapshots:?}");
}

#[test]
fn should_define_domain_setup() {
// Placeholder: Domain setup structure is well-defined
}

#[test]
fn should_create_domain_sinks() {
// Arrange
Expand Down
15 changes: 0 additions & 15 deletions src/boot/storage/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,6 @@ fn should_detect_local_storage_by_default() {
}
}

#[test]
fn should_support_memory_storage_mode() {
// Arrange
let config = BootConfig::with_memory_storage();

// Act
let is_memory_mode = matches!(
config.storage_mode,
crate::boot::runtime::StorageMode::Memory
);

// Assert
assert!(is_memory_mode);
}

#[tokio::test]
async fn should_provision_configured_route_family_column_families() {
// Arrange
Expand Down
6 changes: 0 additions & 6 deletions src/boot/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ use tokio::io::{AsyncReadExt, AsyncWriteExt};

const BOOT_CLEANUP_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(45);

#[test]
fn should_define_boot_module() {
// Placeholder: Module structure is well-defined and
// submodules are unit-testable in isolation
}

#[tokio::test]
async fn should_translate_runtime_drain_into_planned_shutdown() {
// Arrange
Expand Down
201 changes: 0 additions & 201 deletions src/domains/notice/bench.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/domains/notice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ pub mod metrics;
pub mod protocol;
pub mod sink;

pub mod bench; // Zero-copy notification primitives for benchmarking

pub use metrics::NoticeMetrics;
pub use protocol::{
DeliverMessage, NoticeClientNotification, NoticeClientRequest, NoticeClientResponse,
Expand Down
Loading