示例#1
0
    def test_report_not_matched_worker(self):
        g = WorkerMissingGenerator(workers=['other'])

        report = yield g.generate(self.master, None, 'worker.98.complete',
                                  self._get_worker_dict('myworker'))

        self.assertIsNone(report)
示例#2
0
    def test_report_matched_worker(self, worker_filter):
        g = WorkerMissingGenerator(workers=worker_filter)

        report = yield g.generate(self.master, None, 'worker.98.complete',
                                  self._get_worker_dict('myworker'))

        self.assertEqual(report['users'], ['*****@*****.**'])
        self.assertIn(b"worker named myworker went away", report['body'])
    def test_report(self):

        g = WorkerMissingGenerator(workers=['myworker'])

        worker_dict = {
            'name': 'myworker',
            'notify': ["*****@*****.**"],
            'workerinfo': {
                "admin": "myadmin"
            },
            'last_connection': "yesterday"
        }
        report = yield g.generate(self.master, None, 'worker.98.complete',
                                  worker_dict)

        self.assertEqual(report['users'], ['*****@*****.**'])
        self.assertIn(b"has noticed that the worker named myworker went away",
                      report['body'])