Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed flaky test #1788

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions crates/fuel-core/src/service/genesis/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,12 @@ mod tests {
let runner_handle = std::thread::spawn(move || runner.run());

let data = TestData::new(4);
for group in data.as_ok_groups() {
let take = 3;
for group in data.as_ok_groups().into_iter().take(take) {
tx.send(group).unwrap();
}

while read_groups.lock().unwrap().len() < 3 {
while read_groups.lock().unwrap().len() < take {
std::thread::sleep(std::time::Duration::from_millis(1));
}

Expand All @@ -534,7 +535,11 @@ mod tests {

// group after signal is not read
let read_entries = read_groups.lock().unwrap().clone();
let inserted_groups = data.as_entries(0);
let inserted_groups = data
.as_entries(0)
.into_iter()
.take(take)
.collect::<Vec<_>>();
assert_eq!(read_entries, inserted_groups);

// finished signal is emitted
Expand Down
Loading