Changeset

10730:76c9320f69a1

scansion: Mock time libraries during tests The passage of time does not need test coverage, just look in a mirror.
author Kim Alvefur <zash@zash.se>
date Mon, 20 Apr 2020 18:20:24 +0200
parents 10729:dbce2b94a7eb
children 10731:8e2f9d0fa72d
files spec/scansion/prosody.cfg.lua
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/spec/scansion/prosody.cfg.lua	Mon Apr 20 18:17:57 2020 +0200
+++ b/spec/scansion/prosody.cfg.lua	Mon Apr 20 18:20:24 2020 +0200
@@ -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