mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-15 00:44:33 +00:00
tests: add upper bound to test_concurrent_read_write_commit() loop
Hopefully this will fix the unfinished Windows CI issue. A possible scenario is that recent migration to gitoxide made this test flaky on Windows. For example, gitoxide might have in-memory object cache that relies on file mtime, and occasionally fails to detect new object on Windows.
This commit is contained in:
parent
e79c8b6f62
commit
b37293fa68
1 changed files with 15 additions and 1 deletions
|
@ -2909,7 +2909,12 @@ fn test_concurrent_read_write_commit() {
|
|||
pending_commit_ids.rotate_left(i); // start lookup from different place
|
||||
s.spawn(move || {
|
||||
barrier.wait();
|
||||
while !pending_commit_ids.is_empty() {
|
||||
// This loop should finish within a couple of retries, but terminate in case
|
||||
// it doesn't.
|
||||
for _ in 0..100 {
|
||||
if pending_commit_ids.is_empty() {
|
||||
break;
|
||||
}
|
||||
repo = repo.reload_at_head(settings).unwrap();
|
||||
let git_backend = get_git_backend(&repo);
|
||||
let mut tx = repo.start_transaction(settings, &format!("reader {i}"));
|
||||
|
@ -2936,6 +2941,15 @@ fn test_concurrent_read_write_commit() {
|
|||
}
|
||||
thread::yield_now();
|
||||
}
|
||||
if !pending_commit_ids.is_empty() {
|
||||
// It's not an error if some of the readers couldn't observe the commits. It's
|
||||
// unlikely, but possible if the git backend had strong negative object cache
|
||||
// for example.
|
||||
eprintln!(
|
||||
"reader {i} couldn't observe the following commits: \
|
||||
{pending_commit_ids:#?}"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue