Ejemplo n.º 1
0
    def test_to_str(self):
        result = Status('SUCCESS')
        expected = 'status SUCCESS'
        for i in range(10):
            result.add_metric('ping_time_ms_%d' % (i + 1), 'uint64', 325)
            expected += '\nmetric ping_time_ms_%d uint64 325' % (i + 1)

        self.assertEquals(expected, str(result))
Ejemplo n.º 2
0
    def test_add_too_many_metrics(self):
        result = Status()
        for i in range(10):
            result.add_metric('ping_time_ms_%d' % (i + 1), 'uint64', 325)

        self.assertRaisesRegexp(ex.TooManyMetricsError,
                                'Maximum of 10 metrics allowed',
                                result.add_metric,
                                'ping_time_ms_11', 'uint64', 325)
Ejemplo n.º 3
0
 def test_add_metric(self):
     result = Status()
     result.add_metric('ping_time_ms', 'uint64', 325)
     self.assertEquals(1, len(result._metrics))
     self.assertIn(('ping_time_ms', 'uint64', '325'), result._metrics)