Skip to content

fix: teardown environment if setup fails

Jon Foss Mikalsen requested to merge fix/container_startup into master

This MR introduces changes that ensure that the environment is cleaned up if the Dockertest setup fails. Previously, containers would continue to exist if something else in the setup failed after they were created. For example, if Dockertest was instructed to start 2 containers and managed to successfully start the first one, but the second fails, the second one would remain and never be removed.

The setup has now been split into two parts, create and start. Previously, ImageInstances were responsible for both creating and starting Containers, and Containers represented a RUNNING Docker container. Now, ImageInstances are only responsible for creating Containers, and the starting logic has been moved to the Container. Containers no longer represents RUNNING Docker containers, but rather created Docker containers, which may or may not be RUNNING.

There are still lacking some tests, planning to add more tests in the future.

Merge request reports