Mentions légales du service

Skip to content

tests: Make possible to get child actor exit code

SIMONIN Matthieu requested to merge msimonin/2018-vsg:dev/test_wait_actor into master

Fix #28 (closed)

To test client / actor protocol communication, actor execution is forked while client test code is executed in the parent process (the cargo test process).

Until now, as soon as the client (parent process) finishes its execution the actor (child process) is dropped/killed. In some situation the actor don't have the chance to cover all of its test logic. Also actor test logic fails silently in the sense that only error log message are displayed when an asertion fails. No error is propagated to the parent process (parent process).

This patch:

  • make possible to wait for the actor to finish before leaving the test. A wait method is added to the TestActor implementation to wait for the actor to terminate. This can be called by a test if deemed necessary. For instance it's added in run_client_and_actor helper method which covers most of the connector tests.

  • propagate an error to the parent process. User of wait can check the return code of the child process.

  • enable logging by default (this is our only chance for now to gain knowledge on which assertion fails in the child process). Add --nocapture in the Makefile's TEST_FLAGS. Move logger initialization in the connector/unix's test_helpers (we probably need to find a better/common place for that).

Merge request reports