8000 Clarify integration test comments by adityamukho · Pull Request #995 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content
Merged
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
7 changes: 3 additions & 4 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ use minigraf::db::{Minigraf, OpenOptions};
/// was ever really involved. Capping this binary to one fork in flight at a
/// time keeps that window rare enough not to flake the suite.
///
/// This is now belt-and-braces: `FileBackend::open_with` (src/storage/backend/file.rs)
/// retries a cross-process `WouldBlock` with bounded backoff, which is the
/// real fix for the false-negative window described above. This mutex is
/// cheap insurance on top of that, not load-bearing on its own.
/// `FileBackend::open_with` already retries a cross-process `WouldBlock`
/// with bounded backoff. This mutex also prevents two tests in this binary
/// from forking at the same time.
static CRASH_CHILD_SPAWN_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());

/// Whether the crashing child commits `statements` as one explicit
Expand Down
6 changes: 3 additions & 3 deletions tests/cursor_test.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg(test)]
//! `Minigraf::query` and `PreparedQuery::query` return a `Cursor` that delivers
//! the answer in batches (#432). These tests pin the public contract the
//! streaming engine must keep: batches partition the `execute()` answer, the
//! answer is fixed when the cursor opens, and non-queries are rejected.
//! the answer in batches (#432). The tests check that reading every batch gives
//! the same rows as `execute()`, that the answer is fixed when the cursor opens,
//! and that cursors reject non-query statements.
// File-backed (Minigraf::open, tempfile): native only, like the other file tests.
#![cfg(not(target_arch = "wasm32"))]

Expand Down
2 changes: 1 addition & 1 deletion tests/disjunction_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ fn test_or_with_as_of() {
#[test]
fn test_or_with_not_cycle_rejected() {
let db = db();
// Bind ?x first so both or-branches have the same new-variable footprint (none).
// Bind ?x first so neither or branch introduces a new variable.
db.execute(r#"(rule [(p ?x) [?x :a true] (or (and (not (q ?x))) [?x :a true])])"#)
.unwrap();
let result = db.execute(r#"(rule [(q ?x) [?x :b true] (or (and (not (p ?x))) [?x :b true])])"#);
Expand Down
13 changes: 6 additions & 7 deletions tests/docker_lock_test.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#![cfg(test)]
//! #324: kernel file locking, tier 3 — two containers sharing a Docker
//! volume, matching the deployment shape in the #317 report literally.
//! #324: test kernel file locking (tier 3) with two containers sharing a
//! Docker volume, as in #317.
//!
//! Mechanically the same path as `tests/pid_namespace_test.rs` (tier 1): a
//! holder dies without running `Drop`, and a replacement sharing the same
//! storage must still be able to open the database. Docker gives it a real
//! `SIGKILL` and a genuinely separate PID namespace per container, rather
//! than `unshare` simulating one.
//! As in `tests/pid_namespace_test.rs` (tier 1), kill the lock holder without
//! running `Drop`, then check that a replacement can open the same database.
//! Docker sends `SIGKILL` and puts each container in its own PID namespace;
//! the tier 1 test uses `unshare`.
//!
//! Needs a working Docker daemon, which this sandbox does not have and which
//! `.github/workflows/nfs-lock.yml` provisions on its runner. Skips cleanly
Expand Down
7 changes: 3 additions & 4 deletions tests/nfs_lock_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ fn run_helper(helper: &Path, db: &Path, mode: &str) -> Output {
.expect("run helper")
}

/// The helper must reject an unrecognized mode string rather than silently
/// falling through to a plain open. Without this, a typo'd or unimplemented
/// mode (like `open-unlocked` before it exists) is indistinguishable from
/// `open` — exactly the false-green trap this guards against.
/// The helper must reject an unknown mode. If a misspelled or unimplemented
/// mode behaved like `open`, the test could pass without exercising the
/// intended case.
#[test]
fn test_unrecognized_mode_fails_loudly_instead_of_falling_through() {
let helper = helper_binary();
Expand Down
13 changes: 6 additions & 7 deletions tests/nightly_candidates_acceptance_test.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#![cfg(test)]
//! Nightly acceptance for the #841 shape-sweep candidates qualified by #863:
//! each test pins one candidate's answer and the path it guards (operator
//! names from the cursor's `Debug` view, `minigraf::__path_events`) and,
//! where the behavior is memory, its charged query memory
//! (`Cursor::__memory_peak`). Time is measured separately, by the Criterion
//! cases in `benches/minigraf_bench/nightly_candidates.rs`; a path regression
//! fails here, a slower runner cannot.
//! Nightly tests for the #841 candidates qualified by #863. Each test checks
//! the result and execution strategy using operator names from the cursor's
//! `Debug` view and `minigraf::__path_events`. Tests that check memory use
//! `Cursor::__memory_peak` to measure memory charged to the query. Criterion
//! measures time separately in `benches/minigraf_bench/nightly_candidates.rs`;
//! these tests do not check timings.
//!
//! Ignored by default; `.github/workflows/smoke.yml` runs them nightly:
//!
Expand Down
8 changes: 4 additions & 4 deletions tests/recursive_acceptance_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ fn reach_5m() {
assert_eq!(err.code().to_string(), "INT-020", "stopped by the limit");
}

/// Both sizes must meet a retained-relation bound and a coarse time-scaling
/// guard. Doubling a chain quadruples its closure; nonlinear self-joins can
/// do cubic work. The 16x + 1s guard tolerates CI noise without accepting an
/// unbounded blow-up. Absolute per-query budget: 60 seconds.
/// Both sizes must meet the retained-relation bound and finish each query in
/// less than 60 seconds. Doubling the chain roughly quadruples its closure,
/// and nonlinear self-joins can do cubic work. The larger query can take up
/// to 16 times the smaller query's time plus one second for CI timing variation.
fn closure_scaling(multistratum: bool) {
let mut small_time = None;
for nodes in [256usize, 512] {
Expand Down
Loading
0