We have some Java code that works with Docker. For example, one method may create docker network, create a container or two, set the labels, tags, expose some ports etc.
We want to test this, but our unit tests became integration tests, since every test is actually working with real Docker. The major issue with that is the speed of the tests - which we have many - it is horrible slow for developers. And when test is running, the machine is almost frozen.
We do have a layer on top of Docker, plus we use docker java library to talk to the API.
Question: how we should design our tests in this case?
Current idea is to have 'mockup' docker client, that receives commands, but do not issue them on the real docker; and then we can check if commands are set correctly. For this we would also need to simulate docker behavior, like calling docker ps
and so on. Moreover, we can't be 100% sure that command we sent is really working with Docker! Imagine if docker version is changed, and something in API was changed - how we would be able to detect this?
Aucun commentaire:
Enregistrer un commentaire