WL#13708: speed up component tests via systemd notify protocol

Affects: Server-8.0   —   Status: Complete


The component tests of the router start several processes and synchonizes the test-startup by polling the readiness of a service via TCP port probes (loop until connect() succeeds). Each loop has a sleep time until another probe is done of about 100ms.

Each component-test waits 100ms/2 more than it has to be on average which accumulates over the whole test-runtime.

WL#13707 adds systemd notify support to the router which can be used by the component-test to block until a service is ready, without extra wait-time.


  • added systemd notify support to component-tests process manager to speed up the test-startup of component-tests.
  • implement it natively without using <systemd/sd-daemon.h> to use it also on platforms which don't support systemd like windows/solaris/...
The mysql_server_mock should use the same IPC mechanism that the Router introduces in WL#13707 to notify that it is fully ready as a service.
The process_manager in the Router component tests should allow the tests to wait for the processes readiness (Router and mysql_mock_server) using the IPC mechanism from WL#13707.

Implementation details

  • Router component tests that are launching MySQLRouter and/or mysql_mock_server can use NOTIFY_SOCKET environment variable to wait for those processes to become ready. For each process that is spawned and the test expects its readiness, the process_manager should create dedicated named socket in the filesystem (or named pipe on Windows) and pass the path to that socket (name of the named pipe in case of Windows) to the process being launched via NOTIFY_SOCKET environment variable.

  • After launching the process and setting NOTIFY_SOCKET the test should wait on that socket (named pipe on Windows) until it reads READY=1

  • Reaching the timeout while waiting on the READY=1 should be treated as a test failure.

  • The socket file nodes (named pipe paths on Windows) should be removed from the filesystem once the test is finished.