hopfenspace / MateBot

Micro service providing an API for MateBot clients

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix non-detereministic problems while binding to already used ports during unittests

CrsiX opened this issue · comments

commented

This is no big problem, but it prevents the unittests from being completely deterministic, because some unittests might fail just because some random port may already be occupied by some program.

For example, this run of the pipeline failed since some random port was already occupied. The chance that something like that happens is actually pretty small, since a range of over 50000 ports could be used. But as this run showed, it is possible.

The solution could be to use sub-processes that can be killed easily instead of threads running until all unittests completed. Alternatively, it's also possible to implement some other way to easily kill a running MateBot core REST API server (basically just how to kill a uvicorn thread).

commented

Now, one running background thread performs the callback operations. The issue will be closed as resolved.