# \[ANN\] tmp-proc, simplifying docker integration tests

**URL:** <https://discourse.haskell.org/t/ann-tmp-proc-simplifying-docker-integration-tests/3390>\
**Category:** Show and Tell\
**Created:** [October 4, 2021, 12:38am UTC](https://discourse.haskell.org/t/ann-tmp-proc-simplifying-docker-integration-tests/3390 "2021-10-04T00:38:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adetokunbo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/adetokunbo/32/1693_2.png) [@adetokunbo](https://discourse.haskell.org/u/adetokunbo)\
**Post date:** [October 4, 2021, 12:38am UTC](https://discourse.haskell.org/t/ann-tmp-proc-simplifying-docker-integration-tests/3390/1 "2021-10-04T00:38:56Z")

</div>

I’ve written a utility library, [tmp-proc](https://hackage.haskell.org/package/tmp-proc) to simplify the use of `dockerized` backends from Haskell integration tests.

At its core, it shells out to a series of docker commands that bracket test runs, but its API is organized to make it simple from integration test code to

- launch multiple services on docker during test setup
- connect those services to a WAI server being tested
- connect to the launched services to query their state during a test
- teardown the launched services on test completion

This is all done extensibly, and fits in well with setup/teardown hooks in testing libraries like hspec and tasty et al, so it should be both easy to [use](https://github.com/adetokunbo/tmp-proc/tree/master/tmp-proc#readme) and customize.

Interested ? Please try out tmp-proc and let me know what you think.

---

<div class="post-metadata">

**Author:** ![hasufell](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/hasufell/32/1250_2.png) [@hasufell](https://discourse.haskell.org/u/hasufell)\
**Post date:** [October 4, 2021, 9:17am UTC](https://discourse.haskell.org/t/ann-tmp-proc-simplifying-docker-integration-tests/3390/2 "2021-10-04T09:17:17Z")

</div>

Why not use a real docker client talking to the HTTP API?

---

<div class="post-metadata">

**Author:** ![adetokunbo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/adetokunbo/32/1693_2.png) [@adetokunbo](https://discourse.haskell.org/u/adetokunbo)\
**Post date:** [October 4, 2021, 10:54am UTC](https://discourse.haskell.org/t/ann-tmp-proc-simplifying-docker-integration-tests/3390/3 "2021-10-04T10:54:38Z")

</div>

That’s a good idea - are there specific situations where having this will make the library more useful for you ? At the very least it should make it be possible to use docker installations on other network nodes…

At the moment, the library shells out because that was an easy way to get it started. It’s worked for all my use cases so I’ve not really needed to change this so far. I’d be happy to look into using the API if that will make it more useful.

---

<div class="post-metadata">

**Author:** ![hasufell](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/hasufell/32/1250_2.png) [@hasufell](https://discourse.haskell.org/u/hasufell)\
**Post date:** [October 4, 2021, 11:06am UTC](https://discourse.haskell.org/t/ann-tmp-proc-simplifying-docker-integration-tests/3390/4 "2021-10-04T11:06:19Z")

</div>

> [@adetokunbo](#):
>
> At the moment, the library shells out because that was an easy way to get it started. It’s worked for all my use cases so I’ve not really needed to change this so far. I’d be happy to look into using the API if that will make it more useful.

Well, I haven’t looked deep enough, but my guess is:

1. error handling will be better, because you get fine-grained status codes and error payloads
2. Parsing output will be easier and more well-typed

There seems to be [docker: An API client for docker written in Haskell](https://hackage.haskell.org/package/docker)

---

<div class="post-metadata">

**Author:** ![chrisdone](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/chrisdone/32/1408_2.png) [@chrisdone](https://discourse.haskell.org/u/chrisdone)\
**Post date:** [October 4, 2021, 9:16pm UTC](https://discourse.haskell.org/t/ann-tmp-proc-simplifying-docker-integration-tests/3390/5 "2021-10-04T21:16:55Z")

</div>

Thanks for sharing, I’ll try this out tomorrow.
