tests: do not pass in commit objects loaded from different store

For the same reason as 37c41d0eaf.
This commit is contained in:
Yuya Nishihara 2024-08-22 12:09:36 +09:00
parent aef61a6045
commit a3ca6c6f46

View file

@ -61,20 +61,25 @@ fn test_concurrent_checkout() {
// Check out tree2 from another process (simulated by another workspace // Check out tree2 from another process (simulated by another workspace
// instance) // instance)
let mut ws2 = Workspace::load( {
&settings, let mut ws2 = Workspace::load(
&workspace1_root, &settings,
&test_workspace1.env.default_store_factories(), &workspace1_root,
&default_working_copy_factories(), &test_workspace1.env.default_store_factories(),
) &default_working_copy_factories(),
.unwrap(); )
ws2.check_out( .unwrap();
repo.op_id().clone(), // Reload commit from the store associated with the workspace
Some(&tree_id1), let repo = ws2.repo_loader().load_at(repo.operation()).unwrap();
&commit2, let commit2 = repo.store().get_commit(commit2.id()).unwrap();
&CheckoutOptions::empty_for_test(), ws2.check_out(
) repo.op_id().clone(),
.unwrap(); Some(&tree_id1),
&commit2,
&CheckoutOptions::empty_for_test(),
)
.unwrap();
}
// Checking out another tree (via the first workspace instance) should now fail. // Checking out another tree (via the first workspace instance) should now fail.
assert_matches!( assert_matches!(
@ -148,6 +153,9 @@ fn test_checkout_parallel() {
&default_working_copy_factories(), &default_working_copy_factories(),
) )
.unwrap(); .unwrap();
// Reload commit from the store associated with the workspace
let repo = workspace.repo_loader().load_at(repo.operation()).unwrap();
let commit = repo.store().get_commit(commit.id()).unwrap();
// The operation ID is not correct, but that doesn't matter for this test // The operation ID is not correct, but that doesn't matter for this test
let stats = workspace let stats = workspace
.check_out(op_id, None, &commit, &CheckoutOptions::empty_for_test()) .check_out(op_id, None, &commit, &CheckoutOptions::empty_for_test())