summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorGergely Nagy <algernon@balabit.hu>2012-03-21 12:57:19 +0100
committerGergely Nagy <algernon@balabit.hu>2012-03-21 12:57:19 +0100
commitdcea6d50ba8cfd7985c5628a20ce19f0b9ce9993 (patch)
treea7c0f6e25114bb42fd6fdc92850c692ab4cbcd92 /t
parent70e16501eae0d5990df75d6a57f60cb827754d74 (diff)
downloadlibumberlog-dcea6d50ba8cfd7985c5628a20ce19f0b9ce9993.tar.gz
libumberlog-dcea6d50ba8cfd7985c5628a20ce19f0b9ce9993.tar.xz
libumberlog-dcea6d50ba8cfd7985c5628a20ce19f0b9ce9993.zip
Include the hostname in the JSON payload.
Include the hostname (as returned by gethostname()) in the JSON payload. Test case updated to verify this. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Diffstat (limited to 't')
-rw-r--r--t/test_cee_format.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/test_cee_format.c b/t/test_cee_format.c
index 29a4ffd..145c810 100644
--- a/t/test_cee_format.c
+++ b/t/test_cee_format.c
@@ -8,6 +8,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
+#include <limits.h>
static void
verify_value (struct json_object *jo, const char *key,
@@ -60,6 +61,7 @@ test_simple (void)
{
char *msg;
struct json_object *jo;
+ char host[HOST_NAME_MAX + 1];
openlog ("cee-syslog/test_simple", 0, LOG_LOCAL0);
@@ -67,6 +69,8 @@ test_simple (void)
jo = parse_msg (msg);
free (msg);
+ gethostname (host, HOST_NAME_MAX);
+
verify_value (jo, "msg", "hello, I'm test_simple!");
verify_value (jo, "facility", "local0");
verify_value (jo, "priority", "debug");
@@ -74,6 +78,7 @@ test_simple (void)
verify_value_exists (jo, "pid");
verify_value_exists (jo, "uid");
verify_value_exists (jo, "gid");
+ verify_value (jo, "host", host);
json_object_put (jo);
@@ -99,6 +104,7 @@ test_no_discover (void)
verify_value_missing (jo, "pid");
verify_value_missing (jo, "uid");
verify_value_missing (jo, "gid");
+ verify_value_missing (jo, "host");
json_object_put (jo);