Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The unit tests for the dlg daemon check at various times that the underlying nm/dim/mm processes the daemon starts or stops have actually been started or stopped by checking if the manager REST port is open. They did this using our utils.portIsOpen/Closed functions together with a timeout. How these functions work is a bit special: they don't give up on their mission until the condition has been met or the timeout has expired, and therefore they should be used with caution. For example, portIsOpen will return False only after trying to connect to the given host/port until the timeout expires, and True if within that timeout it succeeds in connecting. As such, it's better suited for checking if a service has become offline, but not really for checking if a service is down, as the full timeout would have to be waited for to make that assessment. This was the situation in which some unit tests were on: they waited for long times to check a condition that would be checked much faster if you turned the tables. In the case above, instead of waiting for False to be returned from portIsOpen, a faster alternative is to wait for True to be returned from portIsClosed. This commit changes these checks in a couple of places, bringing the total runtime of the test_daemon unit tests by about 30 seconds (from ~140 to ~110 seconds in my laptop). Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>
- Loading branch information