Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
4 changes: 4 additions & 0 deletions packages/runtime-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ pub const CANDIDATE_VERSION: &str = "5.0.0-dev.6";
mod error;
mod error_stop_diagnostics;
pub use error::CandidateError;
#[cfg(all(test, feature = "native-config-plan"))]
mod test_budget;
#[cfg(test)]
mod test_scratch;
#[cfg(all(test, feature = "native-config-plan"))]
pub(crate) use test_budget::TEST_RUN_BUDGET;
#[cfg(test)]
pub(crate) use test_scratch::next_test_scratch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::{
os::unix::fs::{DirBuilderExt, MetadataExt},
path::PathBuf,
rc::Rc,
time::Duration,
};

struct Fixture {
Expand Down Expand Up @@ -169,7 +168,7 @@ fn enroll(fixture: &Fixture, endpoint: &mut Endpoint<'_>) -> Result<Owner, Candi
state_root: &fixture.data,
binding: &fixture.binding(),
intent: &"d".repeat(32),
deadline: Instant::now() + Duration::from_secs(5),
deadline: Instant::now() + crate::TEST_RUN_BUDGET,
cancelled: &AtomicBool::new(false),
},
endpoint,
Expand All @@ -190,7 +189,7 @@ fn common_original_lock_excludes_second_creator_and_data_has_no_run_binding() {
enrollment::ReadOptions {
state_root: &fixture.data,
binding: &fixture.binding(),
deadline: Instant::now() + Duration::from_secs(5),
deadline: Instant::now() + crate::TEST_RUN_BUDGET,
cancelled: &AtomicBool::new(false),
},
&mut first,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::collections::BTreeMap;
use std::os::unix::fs::{PermissionsExt, symlink};
use std::rc::Rc;
use std::sync::atomic::AtomicU64;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use std::time::{SystemTime, UNIX_EPOCH};

static NEXT: AtomicU64 = AtomicU64::new(0);
struct Fixture(PathBuf);
Expand Down Expand Up @@ -175,7 +175,7 @@ fn options<'a>(
state_root: &fixture.0,
binding,
intent: "dddddddddddddddddddddddddddddddd",
deadline: Instant::now() + Duration::from_secs(10),
deadline: Instant::now() + crate::TEST_RUN_BUDGET,
cancelled,
}
}
Expand All @@ -184,7 +184,7 @@ fn read(fixture: &Fixture, binding: &Binding, fake: &mut Fake) -> Result<Owner,
ReadOptions {
state_root: &fixture.0,
binding,
deadline: Instant::now() + Duration::from_secs(10),
deadline: Instant::now() + crate::TEST_RUN_BUDGET,
cancelled: &AtomicBool::new(false),
},
fake,
Expand Down Expand Up @@ -550,7 +550,7 @@ fn private_file_rules_lock_exclusion_and_final_cancel_fences_are_real() {
ReadOptions {
state_root: &fixture.0,
binding: &binding(),
deadline: Instant::now() + Duration::from_secs(10),
deadline: Instant::now() + crate::TEST_RUN_BUDGET,
cancelled: &cancelled
},
&mut fake
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::*;
use serde_json::{Value, json};
use std::{
os::unix::fs::PermissionsExt,
time::{Duration, SystemTime, UNIX_EPOCH},
time::{SystemTime, UNIX_EPOCH},
};

struct Fixture(PathBuf);
Expand Down Expand Up @@ -193,7 +193,7 @@ fn options<'a>(
state_root: &f.0,
binding: b,
intent: "f0000000000000000000000000000000",
deadline: Instant::now() + Duration::from_secs(5),
deadline: Instant::now() + crate::TEST_RUN_BUDGET,
cancelled,
},
witness: w,
Expand All @@ -203,7 +203,7 @@ fn read_options<'a>(f: &'a Fixture, b: &'a Binding, c: &'a AtomicBool) -> ReadOp
ReadOptions {
state_root: &f.0,
binding: b,
deadline: Instant::now() + Duration::from_secs(5),
deadline: Instant::now() + crate::TEST_RUN_BUDGET,
cancelled: c,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn selected() -> ExecSelection {
}
}
fn ready(session: &mut Session<'_, Fake>, graph: &execution::Graph) {
execution::run(graph, session, Duration::from_secs(2)).unwrap();
execution::run(graph, session, RUN_BUDGET).unwrap();
session
.backend
.state
Expand Down Expand Up @@ -105,7 +105,7 @@ fn finite_exec_uses_exact_live_member_and_one_original_source_data_deadline() {
data_refusal: false,
};
let original = fs::read(session.root.join("state.json")).unwrap();
let deadline = Instant::now() + Duration::from_secs(2);
let deadline = Instant::now() + RUN_BUDGET;
let result =
exec::execute_with(&backend, session.receipt.clone(), &selected(), deadline).unwrap();
assert_eq!(result.exit_code, 17);
Expand Down Expand Up @@ -163,7 +163,7 @@ fn finite_exec_refuses_changed_member_or_data_before_command_and_withholds_resta
+ if mode == "deadline" {
Duration::ZERO
} else {
Duration::from_secs(2)
RUN_BUDGET
};
assert!(
exec::execute_with(&backend, session.receipt.clone(), &request, deadline).is_err(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fn selected() -> run::RunSelection {
}
}
fn ready(session: &mut Session<'_, Fake>, graph: &execution::Graph) {
execution::run(graph, session, Duration::from_secs(2)).unwrap();
execution::run(graph, session, RUN_BUDGET).unwrap();
let mut state = session.backend.state.borrow_mut();
let member = state.containers.values_mut().next().unwrap();
member["State"]["StartedAt"] = json!("2026-10-09T00:00:00.000000000Z");
Expand Down Expand Up @@ -204,7 +204,7 @@ fn finite_one_off_derives_the_exact_member_and_discards_its_record_after_proven_
one_offs: RefCell::new(BTreeMap::new()),
};
let original = fs::read(session.root.join("state.json")).unwrap();
let deadline = Instant::now() + Duration::from_secs(2);
let deadline = Instant::now() + RUN_BUDGET;
let result = run::execute_with(
&backend,
session.receipt.clone(),
Expand Down Expand Up @@ -290,7 +290,7 @@ fn finite_one_off_refuses_changed_member_mounts_or_data_before_create_and_retain
+ if mode == "deadline" {
Duration::ZERO
} else {
Duration::from_secs(2)
RUN_BUDGET
};
assert!(
run::execute_with(
Expand Down Expand Up @@ -337,7 +337,7 @@ fn cleanup_reaps_a_recorded_one_off_before_stopping_members_and_refuses_foreign_
session.receipt.clone(),
&session.root,
&selected(),
Instant::now() + Duration::from_secs(2)
Instant::now() + RUN_BUDGET
)
.is_err()
);
Expand Down
Loading
Loading