# HG changeset patch # User Matthew Wild # Date 1680786054 -3600 # Node ID 012d6e7b723af869378b3a99c38031647622b889 # Parent a97f4b2772214edc30b68300fcbdc34a561700ba integration tests: Preserve unmocked time.monotonic() With monotonic() frozen, timers may fail to trigger. This caused problems after the new util.startup changes that moved the server-started event to a timer. The timer wouldn't trigger, the event didn't fire, and prosody would fail to daemonize. All the tests that depend on specific time behaviour are depending on wall clock time, so only mocking util.time.now() and os.time() fixes those. diff -r a97f4b277221 -r 012d6e7b723a spec/scansion/prosody.cfg.lua --- a/spec/scansion/prosody.cfg.lua Thu Apr 06 08:36:39 2023 +0200 +++ b/spec/scansion/prosody.cfg.lua Thu Apr 06 14:00:54 2023 +0100 @@ -1,15 +1,14 @@ --luacheck: ignore --- Mock time functions to simplify tests +-- Mock time functions to simplify tests -- +local time = require "util.time"; function _G.os.time() return 1219439344; end -package.preload["util.time"] = function () - return { - now = function () return 1219439344.5; end; - monotonic = function () return 0.5; end; - } +function time.now() + return 1219439344.5; end +------------------------------------------- admins = { "admin@localhost" }