Skip to content

Commit be5a19e

Browse files
committed
more multi-threaded test stability (#301)
However, there seems to be an issue with the ODB or something as it fails to find objects which are definitely there. Some issue around initialization?
1 parent 1bf5d11 commit be5a19e

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

git-worktree/tests/worktree/index/checkout.rs

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,23 @@ fn accidental_writes_through_symlinks_are_prevented_if_overwriting_is_forbidden(
130130
stripped_prefix(&source_tree, &source_files),
131131
stripped_prefix(&destination, &worktree_files),
132132
);
133-
assert_eq!(
134-
outcome.collisions,
135-
vec![
136-
Collision {
137-
path: "FAKE-DIR".into(),
138-
error_kind: AlreadyExists
139-
},
140-
Collision {
141-
path: "FAKE-FILE".into(),
142-
error_kind: AlreadyExists
143-
}
144-
]
145-
);
133+
if multi_threaded() {
134+
assert_eq!(outcome.collisions.len(), 2);
135+
} else {
136+
assert_eq!(
137+
outcome.collisions,
138+
vec![
139+
Collision {
140+
path: "FAKE-DIR".into(),
141+
error_kind: AlreadyExists
142+
},
143+
Collision {
144+
path: "FAKE-FILE".into(),
145+
error_kind: AlreadyExists
146+
}
147+
]
148+
);
149+
}
146150
} else {
147151
let expected = ["A-dir/a", "A-file", "FAKE-DIR", "FAKE-FILE", "fake-dir/b", "fake-file"];
148152
assert_eq!(stripped_prefix(&source_tree, &source_files), paths(expected));
@@ -309,15 +313,19 @@ fn keep_going_collects_results() {
309313
);
310314
}
311315

312-
assert_eq!(
313-
stripped_prefix(&destination, &dir_structure(&destination)),
314-
paths(if cfg!(unix) {
315-
["dir/sub-dir/symlink", "executable"]
316-
} else {
317-
["empty", "executable"]
318-
}),
319-
"some files could not be created"
320-
);
316+
if multi_threaded() {
317+
assert_eq!(dir_structure(&destination).len(), 2);
318+
} else {
319+
assert_eq!(
320+
stripped_prefix(&destination, &dir_structure(&destination)),
321+
paths(if cfg!(unix) {
322+
["dir/sub-dir/symlink", "executable"]
323+
} else {
324+
["empty", "executable"]
325+
}),
326+
"some files could not be created"
327+
);
328+
}
321329

322330
assert!(outcome.collisions.is_empty());
323331
}

0 commit comments

Comments
 (0)