Hi all, I have a problem with a test which runs in...
# general
m
Hi all, I have a problem with a test which runs in a seperate docker environment. To be concrete, in the BUILD file of my test folder I have:
Copy code
python_tests(
    environment="test_docker_environment",
)
and in the parent folder the environment is defined
Copy code
docker_environment(
    name="local_test_environment",
    image="image_sha",
)
and in my pants.toml I have added
Copy code
[environments-preview.names]
test_docker_environment = "//parent/folder:local_test_environment"
local = "//:local-environment"
This all works fine and using
pants test ::
the test runs successfully in its own docker container. However, the container remains after the tests and is not removed. This is not a big problem but still a little annoying. Is there a way to change this behaviour and tell pants to clean up all containers that have been startet in tests? Edit: Fixed some typos in the environment names.
Does anyone have an idea?
c
are the tests passing or failing? I guess failing tests could exhibit this bug: https://github.com/pantsbuild/pants/issues/18307 Otherwise, this seems like an issue worth tracking on GH 🙂
m
No, the tests are successfull, I'll file an issue.
c
Thanks. I think this may be by ~design I just realized.. that container is the host for all remote processes pants wants to run, and as long as the pants daemon is alive, that remote environment is kept around. However, I think there may be a missing life cycle feature that should stop that container when pantsd stops. Also, pantsd doesn’t recover well if you manually kill that container and then try to run something that needs it, pants will fail is it knows it should be there, but isn’t, so pantsd needs to be restarted to reset that state again. Caveat, the above pulled from my recollection of what I’ve read before here.. so it may be incomplete and/or wrong.. I think @average-exabyte-61568 or @witty-crayon-22786 can correct any mistakes I’ve made for the above remark.
w
yes, the containers are cached, but they should be cleaned up when
pantsd
restarts cleanly. if
pantsd
restarts uncleanly (due to
kill -9
for example) then they may be orphaned
🙏 1
m
@witty-crayon-22786 also added a comment below yours 🙂 If you should need any further information, please telle me.