From 548881ec14f79a547df67d800e4d67a73de0c2d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vladimir.cunat@nic.cz>
Date: Mon, 14 Jan 2019 16:44:56 +0100
Subject: [PATCH] modules/predict: don't skip reconfiguration if nil is passed

If you didn't specify any configuration (i.e. nil), the stats module
wouldn't get loaded even though the defaults need it to work.
Now we don't skip that part and pass whole .config() even on nil config.
---
 NEWS                                   | 8 ++++++++
 modules/predict/predict.lua            | 5 ++++-
 modules/predict/tests/predict.test.lua | 2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index d54bb03ba..823b5ea89 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Knot Resolver 3.x.y (2019-0m-dd)
+================================
+
+Bugfixes
+--------
+- predict module: load stats module if config didn't specify period (!755)
+
+
 Knot Resolver 3.2.1 (2019-01-10)
 ================================
 
diff --git a/modules/predict/predict.lua b/modules/predict/predict.lua
index 846d4ef7d..470700f3b 100644
--- a/modules/predict/predict.lua
+++ b/modules/predict/predict.lua
@@ -158,7 +158,10 @@ end
 
 function predict.config(config)
 	-- Reconfigure
-	if type(config) ~= 'table' then return end
+	config = config or {}
+	if type(config) ~= 'table' then
+		error('[predict] configuration must be a table or nil')
+	end
 	if config.window then predict.window = config.window end
 	if config.period then predict.period = config.period end
 	-- Load dependent modules
diff --git a/modules/predict/tests/predict.test.lua b/modules/predict/tests/predict.test.lua
index 10431045e..3d7c7f7d2 100644
--- a/modules/predict/tests/predict.test.lua
+++ b/modules/predict/tests/predict.test.lua
@@ -1,5 +1,5 @@
 -- setup resolver
-modules = { 'predict', 'stats' }
+modules = { 'predict' }
 
 -- mock global functions
 local resolve_count = 0
-- 
GitLab