Skip to content
Merged
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
56 changes: 0 additions & 56 deletions src/spec/transaction/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,62 +358,6 @@ fn prepared_recovery_discards_staged_state() {
assert_rolled_back(&fixture);
}

#[test]
fn transaction_drop_releases_lock_with_a_duplicated_descriptor() {
let fixture = transaction_fixture();
let transaction = acquire(&fixture.spec_root).unwrap();
let Transaction { _lock: lock, .. } = &transaction;
let inherited_descriptor = lock.0.try_clone().unwrap();
assert!(
acquire_error(&fixture)
.message()
.contains("another spec archive transaction")
);

drop(transaction);

let recovered = acquire(&fixture.spec_root).unwrap();
drop(inherited_descriptor);
assert!(
acquire_error(&fixture)
.message()
.contains("another spec archive transaction")
);
drop(recovered);
}

#[test]
fn incomplete_health_releases_lock_on_error_before_transaction() {
let fixture = transaction_fixture();
let file = File::create(fixture.spec_root.base().join(LOCK_FILE)).unwrap();
let inherited_descriptor = file.try_clone().unwrap();
let lock = LockGuard::acquire(file).unwrap();
assert!(
acquire_error(&fixture)
.message()
.contains("another spec archive transaction")
);
let state_directory = fixture.spec_root.base().join(TRANSACTION_DIRECTORY);

let result = incomplete_transaction_findings(
&fixture.spec_root,
fixture.spec_root.base().to_path_buf(),
state_directory.clone(),
state_directory.join(JOURNAL_FILE),
lock,
);

assert!(result.is_err());
let recovered = acquire(&fixture.spec_root).unwrap();
drop(inherited_descriptor);
assert!(
acquire_error(&fixture)
.message()
.contains("another spec archive transaction")
);
drop(recovered);
}

#[test]
fn committing_recovery_restores_originals() {
let fixture = fail_at_phase(Phase::Committing);
Expand Down
Loading