[go: up one dir, main page]

Tezt: read full JSON event from channel

Context

This fixes an issue in Tezt tests where large events written on a pipe would sometimes be truncated when we try to read them.

For instance on my machine (MacOS Arm), the call to Lwt_io.read_line on the events pipe returns 8192 or 16384 bytes (this varies between calls), which results in errors such as:

[09:26:40.674] [error] event from daemon1: invalid JSON: JSON.of_buffer unclosed string

I tried to implement a variant of Ezjsonm.from_channel which uses Lwt_io.input_channels but did not succeed (I believe this would be the proper way to parse JSON instead of relying on the fact that events are printed on one line each).

Manually testing the MR

Run the test suite with:

dune exec tezt/tests/main.exe

Checklist

  • [-] Document the interface of any function added or modified (see the coding guidelines)
  • [-] Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • [-] For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR

Merge request reports

Loading