def elysium(mocker): config = Config(mocker.Mock()) sentry_wrapper = mocker.Mock() mocker.patch.object(_AppsCache, 'make_control_ch', return_value=make_mock_channel_with(0)) node = mocker.Mock() node.start_app = mocker.Mock(side_effect=make_mock_channels_list_with( xrange(count_apps(to_run_apps)))) node.control = mocker.Mock(side_effect=make_mock_channels_list_with( xrange(count_apps(to_run_apps)))) submitter = mocker.Mock() submitter.post_committed_state = mocker.Mock( return_value=make_mock_channel_with(0)) return burlak.AppsElysium( Context( LoggerSetup(make_logger_mock(mocker), False), config, '0', sentry_wrapper, mocker.Mock(), ), CommittedState(), node, queues.Queue(), submitter)
def context(mocker): logger = make_logger_mock(mocker) sentry_wrapper = mocker.Mock() config = Config(mocker.Mock()) mocker.patch.object( Defaults, 'NETLINK_NAME', return_value='lan0') return Context( LoggerSetup(logger, False), config, '0', sentry_wrapper, mocker.Mock(), )
def acq(mocker): logger = make_logger_mock(mocker) input_queue = queues.Queue() sentry_wrapper = mocker.Mock() context = Context( LoggerSetup(logger, False), config.Config(mocker.Mock()), '0', sentry_wrapper, mocker.Mock(), ) uniresis = catchup_an_uniresis(use_stub_uuid=TEST_UUID) sharding_setup = ShardingSetup(context, uniresis) return burlak.StateAcquirer(context, sharding_setup, input_queue)
def disp(mocker): node = mocker.Mock() node.list = mocker.Mock() config = mocker.Mock() config.white_list = [] sentry_wrapper = mocker.Mock() workers_distribution = dict() return burlak.StateAggregator( Context( LoggerSetup(make_logger_mock(mocker), False), config, '0', sentry_wrapper, mocker.Mock(), ), node, CommittedState(), queues.Queue(), queues.Queue(), queues.Queue(), 0.01, workers_distribution)
def filter_listener(mocker): logger = make_logger_mock(mocker) filter_queue, input_queue = queues.Queue(), queues.Queue() cfg = config.Config(mocker.Mock()) sentry_wrapper = mocker.Mock() context = Context( LoggerSetup(logger, False), cfg, '0', sentry_wrapper, mocker.Mock(), ) unicorn = mocker.Mock() unicorn.subscribe = mocker.Mock() return burlak.ControlFilterListener(context, unicorn, filter_queue, input_queue)