Skip to content

Commit

Permalink
Added sleep to "fix" I/O test flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
Bungeefan committed May 12, 2024
1 parent e336324 commit cd0e39d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/outputs/advanced_file_output_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,25 @@ void main() {
output.output(event0);
await output.destroy();

// TODO Find out why test is so flaky with durations <1000ms
// Give the OS a chance to flush to the file system (should reduce flakiness)
await Future.delayed(const Duration(milliseconds: 50));
await Future.delayed(const Duration(milliseconds: 1000));

// Start again to roll files on init without waiting for timer tick
await output.init();
final event1 = OutputEvent(LogEvent(Level.fatal, ""), ["2" * 1500]);
output.output(event1);
await output.destroy();

await Future.delayed(const Duration(milliseconds: 50));
await Future.delayed(const Duration(milliseconds: 1000));

// And again for another roll
await output.init();
final event2 = OutputEvent(LogEvent(Level.fatal, ""), ["3" * 1500]);
output.output(event2);
await output.destroy();

await Future.delayed(const Duration(milliseconds: 50));
await Future.delayed(const Duration(milliseconds: 1000));

final files = dir.listSync();

Expand Down

0 comments on commit cd0e39d

Please sign in to comment.