Skip to content

Commit

Permalink
fix: remove snapshot files if previously noticed regression has been …
Browse files Browse the repository at this point in the history
…fixed
  • Loading branch information
junlarsen committed Feb 9, 2025
1 parent 0a6e720 commit dc05b88
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tools/eight-regtest/src/bin/regtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ fn test(args: CommandTestArgs) -> anyhow::Result<()> {
std::process::exit(0);
}

// If there were no changes, but we had a former regression, we can move back the files
if !changed && matches!(snapshot_state, SnapshotState::PreviouslyRegressed(_, _)) {
let regressed_snapshot_path = get_regressed_snapshot_path(&args.snapshot);
let verified_snapshot_path = get_verified_snapshot_path(&args.snapshot);
let updated_snapshot_path = get_updated_snapshot_path(&args.snapshot);
std::fs::rename(regressed_snapshot_path, verified_snapshot_path)?;
std::fs::remove_file(&updated_snapshot_path)?;
}

// Otherwise, we let the user know that the snapshot file has changed.
match snapshot_state {
SnapshotState::Fresh => println!("{}\n", "A new snapshot has been created".cyan()),
Expand Down

0 comments on commit dc05b88

Please sign in to comment.