Hi is there a way to have a resource prepared befo...
# general
b
Hi is there a way to have a resource prepared before some targets and clean up afterwards ? the use case is our integration tests. Before each suite we start progammatically a docker and stop it afterwards. It take ages. A quick win would be to use one docker for all suite. However we would like to have it drove by pants. I can see how to do a start before all : have a task inheriting from junit_test requiring an artifact provided by the task that start the docker. but how to stop it at the end ? we cannot use the same trick because if tests fails, the docker won't be stopped …
p
Interesting you mention this .. I’ve been wanting to raise this for a while. There is a
prep_command
that allows you to setup things before other targets. https://www.pantsbuild.org/build_dictionary.html actually mentions about integration tests. At my work I have implemented a
post_command
and recently a coworker mentioned why not contributing it back. I was wondering if there was any interest in this?
b
well sure there is interest here !
is it publicly available ?
p
Not yet 😅 I will create an issue tomorrow with some more details .. then follow up with the code later
b
great !
thank you very much
p