예제 #1
0
    def test_send_metric(self, m_terminated):
        # mock the termination condition to finish after 1 iteration
        m_terminated.side_effect = [False, True]

        fake_metric = OrderedDict([
            ("name", "compute.node.cpu.percent"),
            ("timestamp", "2015-08-04T15:15:45.703542"), ("unit", "%"),
            ("type", "gauge"), ("value", 97.9), ("resource_id", ""),
            ("host", "test_node"),
            ("resource_metadata",
             OrderedDict([("host", "test_node"),
                          ("title", "compute.node.cpu.percent")]))
        ])

        queue = Queue()
        queue.put(fake_metric)
        worker = Worker(queue, client_name="riemann")
        worker.run()

        # Should check that the data send over via the Riemann client are OK
        self.m_client.send.assert_called_once_with(fake_metric)
예제 #2
0
    def test_send_metric(self, m_terminated):
        # mock the termination condition to finish after 1 iteration
        m_terminated.side_effect = [False, True]

        fake_metric = OrderedDict([
            ("name", "compute.node.cpu.percent"),
            ("timestamp", "2015-08-04T15:15:45.703542"),
            ("unit", "%"),
            ("type", "gauge"),
            ("value", 97.9),
            ("resource_id", ""),
            ("host", "test_node"),
            ("resource_metadata", OrderedDict([
                ("host", "test_node"),
                ("title", "compute.node.cpu.percent")]))
        ])

        queue = Queue()
        queue.put(fake_metric)
        worker = Worker(queue, client_name="riemann")
        worker.run()

        # Should check that the data send over via the Riemann client are OK
        self.m_client.send.assert_called_once_with(fake_metric)
예제 #3
0
 def start_worker(self):
     LOG.debug("[Publisher] starting worker")
     worker = Worker(self.msg_queue, self.metrics_store)
     worker.start()
     self.workers.append(worker)
예제 #4
0
 def start_worker(self):
     LOG.debug("[Publisher] starting worker")
     worker = Worker(self.msg_queue, self.metrics_store)
     worker.start()
     self.workers.append(worker)