mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-10 03:30:59 +00:00
test: finish metadata cleanup sweep
Rename the last stale workflow test helpers and assertions that still used pre-refactor checkpoint/retro file terminology, and update the retro docs to describe the exported layout that now exists.
This commit is contained in:
parent
7dd058cc40
commit
5e482486e7
8 changed files with 13 additions and 23 deletions
|
|
@ -143,4 +143,4 @@ Retros are also available via the REST API. See the [list retros](/api-reference
|
|||
|
||||
## Storage
|
||||
|
||||
Retros are stored in durable run state. If you need files on disk, `fabro store dump` materializes the retro as `retro.json` alongside other exported run data.
|
||||
Retros are stored in durable run state. If you need files on disk, `fabro store dump` materializes retro text under `retro/` alongside `run.json`, stage files, and the rest of the exported run data.
|
||||
|
|
|
|||
|
|
@ -252,15 +252,15 @@ mod tests {
|
|||
for (i, node) in nodes.iter().enumerate() {
|
||||
let mut projection = init_projection.clone();
|
||||
projection.checkpoint = Some(
|
||||
serde_json::from_slice(&make_checkpoint_json(
|
||||
serde_json::from_slice(&make_checkpoint_bytes(
|
||||
node,
|
||||
1,
|
||||
Some(&run_oids[i].to_string()),
|
||||
))
|
||||
.unwrap(),
|
||||
);
|
||||
let checkpoint_json = serde_json::to_vec_pretty(&projection).unwrap();
|
||||
bs.write_entry("run.json", &checkpoint_json, "checkpoint")
|
||||
let projection_json = serde_json::to_vec_pretty(&projection).unwrap();
|
||||
bs.write_entry("run.json", &projection_json, "checkpoint")
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ mod tests {
|
|||
|
||||
let mut checkpoint_projection = make_run_projection(&run_id);
|
||||
checkpoint_projection.checkpoint =
|
||||
Some(serde_json::from_slice(&make_checkpoint_json("start", 1, None)).unwrap());
|
||||
Some(serde_json::from_slice(&make_checkpoint_bytes("start", 1, None)).unwrap());
|
||||
let cp = serde_json::to_vec_pretty(&checkpoint_projection).unwrap();
|
||||
let oid = bs.write_entry("run.json", &cp, "checkpoint").unwrap();
|
||||
let entry = TimelineEntry {
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ mod tests {
|
|||
) -> Vec<u8> {
|
||||
let mut projection = RunProjection::default();
|
||||
projection.checkpoint = Some(
|
||||
serde_json::from_slice(&make_checkpoint_json(current_node, visit, git_commit_sha))
|
||||
serde_json::from_slice(&make_checkpoint_bytes(current_node, visit, git_commit_sha))
|
||||
.unwrap(),
|
||||
);
|
||||
serde_json::to_vec_pretty(&projection).unwrap()
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ pub(super) fn test_sig() -> Signature<'static> {
|
|||
Signature::now("Test", "test@example.com").unwrap()
|
||||
}
|
||||
|
||||
pub(super) fn make_checkpoint_json(
|
||||
pub(super) fn make_checkpoint_bytes(
|
||||
current_node: &str,
|
||||
visit: usize,
|
||||
git_sha: Option<&str>,
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ async fn execute_conditional_routing_uses_unconditional_success_path() {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn execute_writes_start_json_and_node_status() {
|
||||
async fn execute_persists_start_record_and_node_status() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let mut run_options = test_run_options(dir.path(), "test-run");
|
||||
run_options.git = Some(GitCheckpointOptions {
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn finalize_writes_conclusion_json() {
|
||||
async fn finalize_persists_conclusion_in_projection() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let run_dir = temp.path().join("run");
|
||||
std::fs::create_dir_all(&run_dir).unwrap();
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn retro_phase_writes_retro_json() {
|
||||
async fn retro_phase_persists_retro_in_projection() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let run_dir = temp.path().join("run");
|
||||
std::fs::create_dir_all(&run_dir).unwrap();
|
||||
|
|
|
|||
|
|
@ -71,16 +71,6 @@ fn test_run_id(label: &str) -> RunId {
|
|||
}
|
||||
|
||||
fn load_checkpoint(path: &Path) -> Result<Checkpoint, Box<dyn std::error::Error>> {
|
||||
if !path.exists()
|
||||
&& path
|
||||
.file_name()
|
||||
.is_some_and(|name| name == "checkpoint.json")
|
||||
{
|
||||
let run_dir = path
|
||||
.parent()
|
||||
.ok_or("checkpoint path should have a parent")?;
|
||||
return load_run_checkpoint(run_dir);
|
||||
}
|
||||
let data = std::fs::read_to_string(path)?;
|
||||
Ok(serde_json::from_str(&data)?)
|
||||
}
|
||||
|
|
@ -188,9 +178,9 @@ fn load_run_checkpoint(run_dir: &Path) -> Result<Checkpoint, Box<dyn std::error:
|
|||
}
|
||||
|
||||
fn save_checkpoint(path: &Path, checkpoint: &Checkpoint) {
|
||||
let checkpoint_json =
|
||||
let serialized_checkpoint =
|
||||
serde_json::to_string_pretty(checkpoint).expect("checkpoint should serialize to JSON");
|
||||
std::fs::write(path, checkpoint_json).expect("checkpoint file should be written");
|
||||
std::fs::write(path, serialized_checkpoint).expect("checkpoint file should be written");
|
||||
}
|
||||
|
||||
fn test_artifact_store(run_dir: &Path) -> ArtifactStore {
|
||||
|
|
@ -1462,7 +1452,7 @@ async fn pipeline_with_many_nodes() {
|
|||
#[test]
|
||||
fn checkpoint_save_and_resume_roundtrip() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let path = dir.path().join("checkpoint.json");
|
||||
let path = dir.path().join("checkpoint_state.json");
|
||||
|
||||
let ctx = Context::new();
|
||||
ctx.set("goal", serde_json::json!("Test checkpoint"));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue