[syslog-ng] =?y?q?=5BPATCH=20=283=2E4=29=5D=20json=3A=20The=20test=20should=20not=20depend=20on=20the=20environment=27s=20timezone?=
Gergely Nagy
algernon at balabit.hu
Sat Oct 13 19:28:26 CEST 2012
The $(format-json) test was failing when a timezone was set in the
environment that did not match the tests expectations.
To fix this, explicitly set the timezone to UTC.
Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
modules/json/tests/test_json.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/json/tests/test_json.c b/modules/json/tests/test_json.c
index f188b7f..15d038b 100644
--- a/modules/json/tests/test_json.c
+++ b/modules/json/tests/test_json.c
@@ -7,7 +7,7 @@ test_format_json(void)
{
assert_template_format("$(format-json MSG=$MSG)", "{\"MSG\":\"árvÃztűrÅtükörfúrógép\"}");
assert_template_format_with_context("$(format-json MSG=$MSG)", "{\"MSG\":\"árvÃztűrÅtükörfúrógép\"}{\"MSG\":\"árvÃztűrÅtükörfúrógép\"}");
- assert_template_format("$(format-json --scope rfc3164)", "{\"PROGRAM\":\"syslog-ng\",\"PRIORITY\":\"err\",\"PID\":\"23323\",\"MESSAGE\":\"árvÃztűrÅtükörfúrógép\",\"HOST\":\"bzorp\",\"FACILITY\":\"local3\",\"DATE\":\"Feb 11 19:58:35\"}");
+ assert_template_format("$(format-json --scope rfc3164)", "{\"PROGRAM\":\"syslog-ng\",\"PRIORITY\":\"err\",\"PID\":\"23323\",\"MESSAGE\":\"árvÃztűrÅtükörfúrógép\",\"HOST\":\"bzorp\",\"FACILITY\":\"local3\",\"DATE\":\"Feb 11 18:58:35\"}");
assert_template_format("$(format-json msg.text=$MSG msg.id=42 host=bzorp)", "{\"msg\":{\"text\":\"árvÃztűrÅtükörfúrógép\",\"id\":\"42\"},\"host\":\"bzorp\"}");
assert_template_format("$(format-json msg.text.str=$MSG msg.text.len=42 msg.id=42 host=bzorp)",
"{\"msg\":{\"text\":{\"str\":\"árvÃztűrÅtükörfúrógép\",\"len\":\"42\"},\"id\":\"42\"},\"host\":\"bzorp\"}");
@@ -17,6 +17,8 @@ int
main(int argc G_GNUC_UNUSED, char *argv[] G_GNUC_UNUSED)
{
app_startup();
+ putenv("TZ=UTC");
+ tzset();
init_template_tests();
plugin_load_module("json-plugin", configuration, NULL);
--
1.7.10.4
More information about the syslog-ng
mailing list