root/test/t/103_simple_noit.t

Revision 49b8645cf26c988d8416168333196b86d7a99204, 1.1 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 4 years ago)

filtersets are required

  • Property mode set to 100644
Line 
1 use Test::More tests => 6;
2 use XML::LibXML;
3 use XML::LibXML::XPathContext;
4 use testconfig;
5 use apiclient;
6
7 use strict;
8 my $xp = XML::LibXML->new();
9 my $xpc = XML::LibXML::XPathContext->new();
10
11 ok(start_noit("103", { logs_debug => { '' => 'false' } }), 'starting noit');
12 sleep(1);
13 my $c = apiclient->new('localhost', $NOIT_API_PORT);
14 my @r = $c->get("/checks/show/f7cea020-f19d-11dd-85a6-cb6d3a2207dc");
15 is($r[0], 404, 'get checks');
16
17 @r = $c->put("/checks/set/f7cea020-f19d-11dd-85a6-cb6d3a2207dc",
18         qq{<?xml version="1.0" encoding="utf8"?>
19 <check><attributes><target>127.0.0.1</target><period>5000</period><timeout>1000</timeout><name>selfcheck</name><filterset>allowall</filterset><module>selfcheck</module></attributes><config/></check>});
20
21 is($r[0], 200, 'add selfcheck');
22 my $doc = $xp->parse_string($r[1]);
23 is($xpc->findvalue('/check/attributes/uuid', $doc), 'f7cea020-f19d-11dd-85a6-cb6d3a2207dc', 'saved');
24
25 sleep(1);
26 @r = $c->get("/checks/show/f7cea020-f19d-11dd-85a6-cb6d3a2207dc");
27 is($r[0], 200, 'get checks');
28 $doc = $xp->parse_string($r[1]);
29 is($xpc->findvalue('/check/state/state', $doc), 'good', 'results');
30
31 1;
Note: See TracBrowser for help on using the browser.