def test_create_puller_with_router_without_rules_must_raise_RouterWithoutRuleException( self, system, empty_filter, fake_db): puller = system.createActor(PullerActor) puller_start_message = PullerStartMessage('system', 'puller_test', fake_db, empty_filter, False) answer = system.ask(puller, puller_start_message) assert isinstance(answer, ErrorMessage) assert answer.error_message == 'filter without rules'
def test_generate_pusher_with_socket_tags_and_send_it_a_powerReport_must_store_PowerReport_with_right_tag( system, influx_database, power_report): """ Create a PusherGenerator that generate pusher with a PowerReportModel that keep formula_name metadata in PowerReport Generate a pusher connected to an influxDB send a powerReport with formula_name metadata to the pusher test if stored data have tag with formula_name """ config = { 'verbose': True, 'stream': False, 'output': { 'test_pusher': { 'type': 'influxdb', 'tags': 'socket', 'model': 'PowerReport', 'name': 'test_pusher', 'uri': INFLUX_URI, 'port': INFLUX_PORT, 'db': INFLUX_DBNAME } } } generator = PusherGenerator() generator.remove_model_factory('PowerReport') generator.add_model_factory('PowerReport', PowerReport) actors = generator.generate(config) pusher_cls, pusher_start_message = actors['test_pusher'] pusher = system.createActor(pusher_cls) system.ask(pusher, pusher_start_message) system.tell(pusher, power_report) time.sleep(0.3) system.tell(pusher, ActorExitRequest()) influx_database.switch_database(INFLUX_DBNAME) reports = list( influx_database.query('SELECT * FROM "power_consumption"').get_points( tags={'socket': '1'})) assert len(reports) == 1
def fake_dispatcher(self, system, dummy_pipe_in): dispatcher = system.createActor(DummyActor) system.tell(dispatcher, DummyStartMessage('system', 'dispatcher', dummy_pipe_in)) return dispatcher
def actor(self, system): puller = system.createActor(PullerActor) yield puller system.tell(puller, ActorExitRequest())
def actor(self, system): actor = system.createActor(DummyFormulaActor) yield actor system.tell(actor, ActorExitRequest())
def actor(self, system): actor = system.createActor(DispatcherActor) yield actor system.tell(actor, ActorExitRequest())