Skip to content

Commit bf2a4f9

Browse files
sfauvelDamien LACHAUME / PALO-IT
authored andcommitted
Force log flush before read it in test
1 parent 8a0f5c7 commit bf2a4f9

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

mithril-common/src/cardano_transaction_parser.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,16 @@ mod tests {
299299
immutable_file_number: 4831,
300300
..Beacon::default()
301301
};
302-
let cardano_transaction_parser =
303-
CardanoTransactionParser::new(create_file_logger(&filepath), true);
304-
305-
cardano_transaction_parser
306-
.parse(db_path, &beacon)
307-
.await
308-
.unwrap();
302+
// We create a block to drop the logger and force a flush before we read the log file.
303+
{
304+
let cardano_transaction_parser =
305+
CardanoTransactionParser::new(create_file_logger(&filepath), true);
306+
307+
cardano_transaction_parser
308+
.parse(db_path, &beacon)
309+
.await
310+
.unwrap();
311+
}
309312

310313
let log_file = std::fs::read_to_string(&filepath).unwrap();
311314
assert!(log_file.contains("The cbor encoded block could not be parsed"));

0 commit comments

Comments
 (0)