Ejemplo n.º 1
0
 def testNginxPlus(self):
     test_data = read_data_from_file('nginx_plus_in.json')
     expected = eval(read_data_from_file('nginx_plus_out.python'))
     nginx, instances = get_check('nginx', self.nginx_config)
     parsed = nginx.parse_json(test_data)
     parsed.sort()
     self.assertEquals(parsed, expected)
Ejemplo n.º 2
0
 def testNginxPlus(self):
     test_data = read_data_from_file('nginx_plus_in.json')
     expected = eval(read_data_from_file('nginx_plus_out.python'))
     nginx, instances = get_check('nginx', self.nginx_config)
     parsed = nginx.parse_json(test_data)
     parsed.sort()
     self.assertEquals(parsed, expected)
Ejemplo n.º 3
0
 def test_nginx_plus(self):
     test_data = read_data_from_file('nginx_plus_in.json')
     expected = eval(read_data_from_file('nginx_plus_out.python'))
     nginx = load_check('nginx', self.config, self.agent_config)
     parsed = nginx.parse_json(test_data)
     parsed.sort()
     self.assertEquals(parsed, expected)
Ejemplo n.º 4
0
 def test_nginx_plus(self):
     test_data = read_data_from_file('nginx_plus_in.json')
     expected = eval(read_data_from_file('nginx_plus_out.python'))
     nginx = load_check('nginx', self.config, self.agent_config)
     parsed = nginx.parse_json(test_data)
     parsed.sort()
     self.assertEquals(parsed, expected)
Ejemplo n.º 5
0
 def __init__(self, *args, **kwargs):
     unittest.TestCase.__init__(self, *args, **kwargs)
     self.config = {"instances": [{"foo": "bar"}]}
     self.check = load_check(self.CHECK_NAME, self.config, {})
     self.check._connect = Mock(
         return_value=(None, None, ["aggregation_key:localhost:8080"]))
     self.check._get_stats = Mock(return_value=self.check.load_json(
         read_data_from_file("riakcs_in.json")))
Ejemplo n.º 6
0
 def __init__(self, *args, **kwargs):
     unittest.TestCase.__init__(self, *args, **kwargs)
     self.config = {"instances": [{
         "access_id":"foo",
         "access_secret": "bar"}]}
     self.check = load_check(self.CHECK_NAME, self.config, {})
     self.check._connect = Mock(return_value=(None, None, ["aggregation_key:localhost:8080"]))
     self.check._get_stats = Mock(return_value=self.check.load_json(read_data_from_file("riakcs_in.json")))
Ejemplo n.º 7
0
 def test_metrics(self):
     self.run_check(self.config)
     expected = eval(read_data_from_file("riakcs_metrics.python"))
     for m in expected:
         self.assertMetric(m[0], m[2], m[3].get('tags', []))
Ejemplo n.º 8
0
 def test_parser(self):
     input_json = read_data_from_file("riakcs_in.json")
     output_python = read_data_from_file("riakcs_out.python")
     self.assertEquals(self.check.load_json(input_json),
                       eval(output_python))
Ejemplo n.º 9
0
 def test_metrics(self):
     self.run_check(self.config)
     expected = eval(read_data_from_file("riakcs_metrics.python"))
     for m in expected:
         self.assertMetric(m[0], m[2], m[3].get('tags', []))
Ejemplo n.º 10
0
 def test_parser(self):
     input_json = read_data_from_file("riakcs_in.json")
     output_python = read_data_from_file("riakcs_out.python")
     self.assertEquals(self.check.load_json(input_json), eval(output_python))