Пример #1
0
 def test_array_expand(self):
     m = Measure.array(
             [u'name1', u'name2'], [21], [u'uom'], [u'-10:10'], [u'-20:20'],
             [-50])
     self.assertEqual([
         Measure(u'name1', 21, u'uom', u'-10:10', u'-20:20', -50),
         Measure(u'name2', 21, u'uom', u'-10:10', u'-20:20', -50)], m)
Пример #2
0
 def test_array(self):
     m = Measure.array(
             [u'm1', u'm2'], [1, 2], [u'u1', u'u2'], [u'0:1', u'0:2'],
             [u'0:2', u'0:3'], [0, 0], [10, 20])
     self.assertEqual([
         Measure(u'm1', 1, u'u1', u'0:1', u'0:2', 0, 10),
         Measure(u'm2', 2, u'u2', u'0:2', u'0:3', 0, 20)], m)
Пример #3
0
 def test_performance_show_zero_min(self):
     m = Measure(u'm4', 15, u's', minimum=0)
     self.assertEqual(u'm4=15s;;;0', m.performance())
Пример #4
0
 def test_short_performance(self):
     m = Measure(u'm3', 4)
     self.assertEqual(u'm3=4', m.performance())
Пример #5
0
 def test_performance(self):
     m = Measure(u'm2', 75, u'MB', warning=u'33:80',
                         critical=u'31:82', minimum=10, maximum=100)
     self.assertEqual(u'm2=75MB;33:80;31:82;10;100',
                      m.performance())
Пример #6
0
 def test_crit(self):
     m = Measure(u'm1', 9.5, u's', warning=u'8', critical=u'9.4')
     s = m.state()
     self.assertEqual(u'CRITICAL', str(s))
     self.assertEqual(u'm1 value 9.5s exceeds critical range 9.4',
                      s.headline())
Пример #7
0
 def test_warn(self):
     m = Measure(u'm1', 9, u's', warning=u'8', critical=u'9.4')
     s = m.state()
     self.assertEqual(u'WARNING', str(s))
     self.assertEqual(u'm1 value 9s exceeds warning range 8',
                      s.headline())
Пример #8
0
 def test_ok(self):
     m = Measure(u'm1', 8, warning=u'8', critical=u'9.4')
     self.assertEqual(u'OK', str(m.state()))