Skip to content

Commit 677fe85

Browse files
authored
RUST-1100 Fix find_and_getmore_share_session flakiness (#826)
1 parent a9f6e88 commit 677fe85

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.evergreen/env.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ if [[ "$OS" == "Windows_NT" ]]; then
1919
export PATH
2020
echo "updated path on windows PATH=$PATH"
2121
else
22+
# Turn off tracing for the very-spammy nvm script.
23+
set +o xtrace
2224
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
2325
fi

src/client/session/test/mod.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,17 @@ async fn find_and_getmore_share_session() {
571571
.read_concern(ReadConcern::local())
572572
.build();
573573

574-
let mut cursor = coll
575-
.find(doc! {}, options)
576-
.await
577-
.expect("find should succeed");
574+
// Loop until data is found to avoid racing with replication.
575+
let mut cursor;
576+
loop {
577+
cursor = coll
578+
.find(doc! {}, options.clone())
579+
.await
580+
.expect("find should succeed");
581+
if cursor.has_next() {
582+
break;
583+
}
584+
}
578585

579586
for _ in 0..3 {
580587
cursor

0 commit comments

Comments
 (0)