aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-04-20 18:20:24 +0200
committerKim Alvefur <zash@zash.se>2020-04-20 18:20:24 +0200
commit5955cc392426300b07c9cbfdb80371a14de6b729 (patch)
tree3ee7d88dccfedf407b54a8e5446993a4aa7b8b53
parent9036462dcbb26ca029ee4d7709f4d8d2a377734c (diff)
downloadprosody-5955cc392426300b07c9cbfdb80371a14de6b729.tar.gz
prosody-5955cc392426300b07c9cbfdb80371a14de6b729.zip
scansion: Mock time libraries during tests
The passage of time does not need test coverage, just look in a mirror.
-rw-r--r--spec/scansion/prosody.cfg.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/scansion/prosody.cfg.lua b/spec/scansion/prosody.cfg.lua
index d7444e7a..88a5e0c9 100644
--- a/spec/scansion/prosody.cfg.lua
+++ b/spec/scansion/prosody.cfg.lua
@@ -1,5 +1,16 @@
--luacheck: ignore
+-- Mock time functions to simplify tests
+function _G.os.time()
+ return 1219439344;
+end
+package.preload["util.time"] = function ()
+ return {
+ now = function () return 1219439344.1; end;
+ monotonic = function () return 0.1; end;
+ }
+end
+
admins = { "admin@localhost" }
use_libevent = true