Skip to content

Commit

Permalink
Fix non-deterministic test pause_by_space
Browse files Browse the repository at this point in the history
There was no sleep between unpause and exit, causing a race condition on some
terminal emulators, which is the root cause of random CI failures on Windows.

However, it's important to note that the "failure case" we saw on Windows is
actually the correct expected case of the test. On Linux and MacOS, the race
always resolves one way, causing the unpause event to be in practise untested.

To fix it, I simply made sure events are always separated by sleeps.
  • Loading branch information
cyqsimon committed Oct 17, 2023
1 parent bc604df commit 464f7ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR
resume. Use <TAB> to rea range tables. (DNS queries hi den).

--- SECTION SEPARATOR ---
Total Up / Down: 0Bps / 0Bps



Expand Down Expand Up @@ -154,6 +155,5 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR





pause. Use <TAB> to rear ange tables. (DNS queries hid en).

2 changes: 1 addition & 1 deletion src/tests/cases/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ fn pause_by_space() {
None,
Some(KeyEvent::new(KeyCode::Char(' '), KeyModifiers::NONE)),
None,
None,
Some(KeyEvent::new(KeyCode::Char(' '), KeyModifiers::NONE)),
None,
Some(KeyEvent::new(KeyCode::Char('c'), KeyModifiers::CONTROL)),
]
.into_iter()
Expand Down

0 comments on commit 464f7ec

Please sign in to comment.