test(fileio_spec): unreliable fsync test

Problem:
CI sometimes fails. Something is triggering an extra fsync().

    FAILED   test/functional/core/fileio_spec.lua @ 52: fileio fsync() codepaths #8304
    test/functional/core/fileio_spec.lua:87: Expected objects to be the same.
    Passed in:
    (number) 3
    Expected:
    (number) 2
    stack traceback:
            test/functional/core/fileio_spec.lua:87: in function <test/functional/core/fileio_spec.lua:52>

Solution:
Relax the assertion to `fsync >= 2` instead of exactly 2.

(Note this is not a behavior change: the next assertion has always
checked `fsync == 4`, it's just that the intermediate 3rd fsync was
never explicitly asserted.)
This commit is contained in:
Justin M. Keyes
2023-12-05 13:52:51 +01:00
parent 1457272726
commit 1fd29a2884
3 changed files with 26 additions and 26 deletions

View File

@@ -149,9 +149,9 @@ end
--- Retries for 1 second in case of filesystem delay.
---
---@param pat (string) Lua pattern to match lines in the log file
---@param logfile (string) Full path to log file (default=$NVIM_LOG_FILE)
---@param nrlines (number) Search up to this many log lines
---@param inverse (boolean) Assert that the pattern does NOT match.
---@param logfile? (string) Full path to log file (default=$NVIM_LOG_FILE)
---@param nrlines? (number) Search up to this many log lines
---@param inverse? (boolean) Assert that the pattern does NOT match.
function module.assert_log(pat, logfile, nrlines, inverse)
logfile = logfile or os.getenv('NVIM_LOG_FILE') or '.nvimlog'
assert(logfile ~= nil, 'no logfile')