Skip to content

Commit

Permalink
Update happy path rx/tx fdm test to read and write data from the call…
Browse files Browse the repository at this point in the history
…back
  • Loading branch information
julianneswinoga committed Oct 26, 2022
1 parent ae6e250 commit b504477
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/test_fdm_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ def mock_socket_bind(self, addr):


@pytest.mark.parametrize('fdm_version', supported_fdm_versions)
def test_fdm_happypath(mocker, fdm_version):
rx_cb = lambda s, e_p: s
def test_fdm_rx_and_tx(mocker, fdm_version):
def rx_cb(fdm_data, event_pipe):
run_idx, = event_pipe.child_recv()
callback_version = fdm_data['version']
event_pipe.child_send((run_idx, callback_version,))
return fdm_data

fdm_c = FDMConnection(fdm_version)

Expand All @@ -49,6 +53,10 @@ def test_fdm_happypath(mocker, fdm_version):
fdm_c.connect_rx('localhost', 55550, rx_cb)
fdm_c.connect_tx('localhost', 55551)

for i in range(500):
for i in range(100):
fdm_c.event_pipe.parent_send((i,))
# manually call the process instead of having the process spawn
fdm_c._fg_packet_roundtrip()
run_idx, callback_version = fdm_c.event_pipe.parent_recv()
assert run_idx == i
assert callback_version == fdm_version

0 comments on commit b504477

Please sign in to comment.