Nagios::CheckMkAgent probe tests
Robert 'phaylon' Sedlacek [Wed, 9 May 2012 21:23:06 +0000 (21:23 +0000)]
t/nagios-checkmkagent.t [new file with mode: 0644]

diff --git a/t/nagios-checkmkagent.t b/t/nagios-checkmkagent.t
new file mode 100644 (file)
index 0000000..0ffcc08
--- /dev/null
@@ -0,0 +1,24 @@
+use strictures 1;
+use Test::More;
+
+use System::Introspector::Nagios::CheckMkAgent;
+
+no warnings 'redefine';
+*System::Introspector::Nagios::CheckMkAgent::_get_check_mk_agent_output = sub {
+    return map "$_\n",
+        '<<<foo>>>',
+        'bar',
+        'baz',
+        '<<<bar>>>',
+        '<<<baz>>>',
+        'qux';
+};
+
+my $probe = System::Introspector::Nagios::CheckMkAgent->new;
+my $data = $probe->gather;
+
+is_deeply $data,
+    { foo => [qw( bar baz )], bar => [], baz => [qw( qux )] },
+    'output parsing worked';
+
+done_testing;