Beispiel #1
0
    def test_constructor(self):
        # create a basic orchestrator
        orchestrator = Orchestrator(rabbitmq_url="test.rabbitmq.com:8000")

        # test is started should be false
        self.assertEqual(orchestrator._service_inited, False)

        # test that service validation should through an exception
        with self.assertRaises(EasyJobServiceNotStarted) as e:
            orchestrator.validate_init()

        # test when config is set while creating then value is reflected in the config
        orchestrator1 = Orchestrator(rabbitmq_url="test.rabbitmq.com:8000",
                                     max_worker_count=34)
        self.assertEqual(orchestrator1.get_config().max_worker_count, 34)
Beispiel #2
0
    def test__setup_entities(self, producer_mock, exchange_mock,
                             connection_mock):
        # create a basic orchestrator
        orchestrator = Orchestrator(rabbitmq_url="test.rabbitmq.com:8000")

        orchestrator.setup_entities()
        exchange_mock.assert_called_with(
            orchestrator.get_config().get_mq_config(constants.EXCHANGE),
            type='topic',
            durable=True)

        connection_mock.assert_called_with(
            "test.rabbitmq.com:8000",
            transport_options={'confirm_publish': True})

        producer_mock.assert_called()