diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7985bb15..23ca1805 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,6 +4,7 @@ on: push: branches: - main + - fix-tests pull_request: branches: diff --git a/test/functional/Functional/Buffering.hs b/test/functional/Functional/Buffering.hs index 60c1e564..9f3fcf0c 100644 --- a/test/functional/Functional/Buffering.hs +++ b/test/functional/Functional/Buffering.hs @@ -28,16 +28,30 @@ logsNoBuffer = -- literally i.e. {0..3}. The manual listing of indices appears to work, -- however args = + -- Having the indexes be 1.3, 2.6, ... rather than integers does not + -- change anything, but it makes the output slightly clearer. withNoConfig [ "--cmd-log", "--cmd-log-strip-control=all", "--cmd-name-trunc=15", - "for i in 0 1 2 3; do echo \"$i\"; sleep 1.5; done" + "for i in 0 1.3 2.6 3.9; do echo \"$i\"; sleep 1.3; done" ] -- To test that the logs are correctly streamed, we check that actual -- order of logs against the timing logs. This is a bit hacky, but the - -- sleep of 1.5 makes this fairly reliable. + -- sleep of 1.3 makes this more reliable. + -- + -- Here is why we choose 1.3. We want to avoid a race between Timer logs + -- (every second) and Command logs, so we want these on different + -- intervals. + -- + -- An offset of 1.5 would coincide at t=3, so this is not good. + -- The first collision with 1.3, on the other hand, is t=11, because the + -- LCM of 3 and 10 is 30. This is longer than the test runs, so this + -- should be okay. + -- + -- An alternative would be to have the timer on the same interval (1 s) and + -- simply preface the loop with a sleep of 0.5 s. expecteds = [ withCommandPrefix "for i in 0 1..." "Starting...", withCommandPrefix "for i in 0 1..." "0", @@ -46,11 +60,11 @@ logsNoBuffer = withTimerPrefix "2 seconds", withCommandPrefix "for i in 0 1..." "2", withTimerPrefix "3 seconds", - withTimerPrefix "4 seconds", withCommandPrefix "for i in 0 1..." "3", + withTimerPrefix "4 seconds", withTimerPrefix "5 seconds", - withSuccessPrefix "for i in 0 1..." <> "6 seconds", - withFinishedPrefix "6 seconds" + withSuccessPrefix "for i in 0 1..." <> "5 seconds", + withFinishedPrefix "5 seconds" ] assertLogsEq :: List Text -> List Text -> IO ()