Hello :wave:! I have starting to scratch pants sur...
# general
l
Hello 👋! I have starting to scratch pants surface and seems very interesting 😉 . I have a bunch of python repos, every repo goal is to build a docker container with contents depending on files on the repo. I have successfully built docker images using
docker_image
instructions and I can run them using
run container
command. Now, I want to add some integration tests which only pass if container is running to attend requests generated in python_test sections. How I can start a
docker_container
before running
python_tests
? Thx!
l
I’m trying to do something similar and currently using this https://www.pantsbuild.org/docs/environments
oh wait, I think I misunderstood, in the case you want containers up before running the tests, for that all I have is a docker-compose.yml that I fire up before running the tests
l
yes, I want containers up before running the tests. How I can fire up a docker-compose file with pants?
l
I’m not using pants for that 😞
I reference the images built with pants in my docker-compose.yml and then run a regular
docker compose
command
l
ok, thanks. Maybe a
shell_command
running docker-compose could work?
c
there’s currently not much support for setup/teardown around running tests with pants. You can use
shell_command
for setup, but it will leave it running also after the tests etc..
l
ok, thanks
b
Using shell_command may be a bit unreliable: it is cacheable, and just focused on file outputs (that is, best for “pure” code generation and similar): if the inputs are the same, pants won’t rerun it, because it will just pull the resulting files from its cache. This is a problem if the containers have stopped: pants won’t know and won’t restart. https://github.com/pantsbuild/pants/issues/16362 is a feature request issue.
👍 1