def test_get_event_details(self):
        history = builder.History(ExampleWorkflow, input={})
        signal_input = {'x': 42, 'foo': 'bar', '__propagate': False}
        marker_details = {'baz': 'bae'}
        history.add_signal('a_signal', signal_input)
        history.add_marker('a_marker', marker_details)
        history.add_timer_started('a_timer', 1, decision_id=2)
        history.add_timer_fired('a_timer')

        executor = Executor(DOMAIN, ExampleWorkflow)
        executor.replay(Response(history=history, execution=None))

        details = executor.get_event_details('signal', 'a_signal')
        del details['timestamp']
        expect(details).to.equal({
            'type': 'signal',
            'state': 'signaled',
            'name': 'a_signal',
            'input': signal_input,
            'event_id': 4,
            'external_initiated_event_id': 0,
            'external_run_id': None,
            'external_workflow_id': None,
        })

        details = executor.get_event_details('signal', 'another_signal')
        expect(details).to.be.none

        details = executor.get_event_details('marker', 'a_marker')
        del details['timestamp']
        expect(details).to.equal({
            'type': 'marker',
            'state': 'recorded',
            'name': 'a_marker',
            'details': marker_details,
            'event_id': 5,
        })
        details = executor.get_event_details('marker', 'another_marker')
        expect(details).to.be.none

        details = executor.get_event_details('timer', 'a_timer')
        del details['started_event_timestamp']
        del details['fired_event_timestamp']
        expect(details).to.equal({
            'type': 'timer',
            'state': 'fired',
            'id': 'a_timer',
            'decision_task_completed_event_id': 2,
            'start_to_fire_timeout': 1,
            'started_event_id': 6,
            'fired_event_id': 7,
            'control': None,
        })
        details = executor.get_event_details('timer', 'another_timer')
        expect(details).to.be.none
Example #2
0
    def test_get_event_details(self):
        history = builder.History(ExampleWorkflow, input={})
        signal_input = {'x': 42, 'foo': 'bar', '__propagate': False}
        marker_details = {'baz': 'bae'}
        history.add_signal('a_signal', signal_input)
        history.add_marker('a_marker', marker_details)
        history.add_timer_started('a_timer', 1, decision_id=2)
        history.add_timer_fired('a_timer')

        executor = Executor(DOMAIN, ExampleWorkflow)
        executor.replay(Response(history=history, execution=None))

        details = executor.get_event_details('signal', 'a_signal')
        del details['timestamp']
        expect(details).to.equal({
            'type': 'signal',
            'state': 'signaled',
            'name': 'a_signal',
            'input': signal_input,
            'event_id': 4,
            'external_initiated_event_id': 0,
            'external_run_id': None,
            'external_workflow_id': None,
        })

        details = executor.get_event_details('signal', 'another_signal')
        expect(details).to.be.none

        details = executor.get_event_details('marker', 'a_marker')
        del details['timestamp']
        expect(details).to.equal({
            'type': 'marker',
            'state': 'recorded',
            'name': 'a_marker',
            'details': marker_details,
            'event_id': 5,
        })
        details = executor.get_event_details('marker', 'another_marker')
        expect(details).to.be.none

        details = executor.get_event_details('timer', 'a_timer')
        del details['started_event_timestamp']
        del details['fired_event_timestamp']
        expect(details).to.equal({
            'type': 'timer',
            'state': 'fired',
            'id': 'a_timer',
            'decision_task_completed_event_id': 2,
            'start_to_fire_timeout': 1,
            'started_event_id': 6,
            'fired_event_id': 7,
            'control': None,
        })
        details = executor.get_event_details('timer', 'another_timer')
        expect(details).to.be.none
Example #3
0
    def test_get_event_details(self):
        history = builder.History(ExampleWorkflow, input={})
        signal_input = {"x": 42, "foo": "bar", "__propagate": False}
        marker_details = {"baz": "bae"}
        history.add_signal("a_signal", signal_input)
        history.add_marker("a_marker", marker_details)
        history.add_timer_started("a_timer", 1, decision_id=2)
        history.add_timer_fired("a_timer")

        executor = Executor(DOMAIN, ExampleWorkflow)
        executor.replay(Response(history=history, execution=None))

        details = executor.get_event_details("signal", "a_signal")
        del details["timestamp"]
        expect(details).to.equal(
            {
                "type": "signal",
                "state": "signaled",
                "name": "a_signal",
                "input": signal_input,
                "event_id": 4,
                "external_initiated_event_id": 0,
                "external_run_id": None,
                "external_workflow_id": None,
            }
        )

        details = executor.get_event_details("signal", "another_signal")
        expect(details).to.be.none

        details = executor.get_event_details("marker", "a_marker")
        del details["timestamp"]
        expect(details).to.equal(
            {
                "type": "marker",
                "state": "recorded",
                "name": "a_marker",
                "details": marker_details,
                "event_id": 5,
            }
        )
        details = executor.get_event_details("marker", "another_marker")
        expect(details).to.be.none

        details = executor.get_event_details("timer", "a_timer")
        del details["started_event_timestamp"]
        del details["fired_event_timestamp"]
        expect(details).to.equal(
            {
                "type": "timer",
                "state": "fired",
                "id": "a_timer",
                "decision_task_completed_event_id": 2,
                "start_to_fire_timeout": 1,
                "started_event_id": 6,
                "fired_event_id": 7,
                "control": None,
            }
        )
        details = executor.get_event_details("timer", "another_timer")
        expect(details).to.be.none