tests: attempt to de-flake operation-merging test

We resolve checkouts in favor of the first-committed operation (which
is more likely to have managed to update the working copy). The test
case has been flaky on GitHub lately. I've run it 1000 times on my
machine without failure. I don't know if GitHub's machines are just
faster in some way (SSD, maybe) that makes them finish the two
operations in the test in the same millisecond. Let's add a
1-millisecond sleep to see if that helps. If it doesn't, then maybe
the issue is that the clock has lower precision (or their clocks can
go backwards?).
This commit is contained in:
Martin von Zweigbergk 2022-02-09 10:40:51 -08:00
parent b74851e005
commit dabfd04da6

View File

@ -210,6 +210,9 @@ fn test_merge_views_checkout() {
tx2.mut_repo().remove_checkout(&ws5_id);
tx2.mut_repo()
.set_checkout(ws7_id.clone(), commit3.id().clone());
// Make sure the end time different, assuming the clock has sub-millisecond
// precision.
std::thread::sleep(std::time::Duration::from_millis(1));
tx2.commit();
let repo = repo.reload();