Testing ustats configuration generation.

-- Testcase --
{%
	let real_include = include;

	include("./cfg/ucentral.uc", {
		TRACE_CALLS: "stderr",

		/* wrap include() to fixup the include paths */
		include: function(path, scope) {
			path = replace(path, "/usr/share/ucentral/", "../cfg/");

			/* make path absolute */
			if (index(path, "/") != 0) {
				try {
					die();
				} catch(e) {
					path = replace(e.stacktrace[1].filename, /\/[^\/]+$/, '') + '/' + path;
				};
			}

			return real_include(path, scope);
		}
	})
%}
-- End --

-- Environment --
{
	"capab": {},
	"cfg": {
		"stats" : {
			"interval" : 60,
			"lldp" : 1,
			"neighbours" : 1,
			"pids" : 1,
			"poe" : 1,
			"serviceprobe" : 1,
			"system" : 1,
			"traffic" : 1,
			"wifiiface" : 1,
			"wifistation" : 1
		},
		"uuid" : 1614778970
	}
}
-- End --

-- File fs/stat~_usr_share_ucentral_cfg_stats_uc.json --
{ "type": "file" }
-- End --

-- Expect stderr --
[call] fs.stat path </usr/share/ucentral/cfg_stats.uc>
-- End --

-- Expect stdout --
set ustats.stats.interval='3600'
set ustats.stats.neighbours='1'
set ustats.stats.traffic='1'
set ustats.stats.wifiiface='1'
set ustats.stats.wifistation='1'
set ustats.stats.pids='1'
set ustats.stats.serviceprobe='1'
set ustats.stats.lldp='1'
set ustats.stats.system='1'
set ustats.stats.poe='1'
-- End --
