[Raw idea] Integrate Jepsen with test-containers and manage Docker right in DB object
ligurio opened this issue · comments
It is possible to set up a Jepsen environment in Docker containers [1]. However, it is not convenient to manage part of setup and teardown with docker-compose templates and shell scripts that should be run manually. I propose to make seamless integration with Docker using test-containers. It will allow managing environment using Clojure source code [2] [3], for example:
(require '[clj-test-containers.core :as tc])
(def container (-> (tc/create {:image-name "postgres:12.1"
:exposed-ports [5432]
:env-vars {"POSTGRES_PASSWORD" "verysecret"}})
(tc/bind-filesystem! {:host-path "/tmp"
:container-path "/opt"
:mode :read-only})
(tc/start!)))
(do-database-testing (:host container)
(get (:mapped-ports container) 5432))
(tc/stop! container)
You could do this with a custom DB or OS object, but I don't plan to do it myself--there are essentially no tests that I want to couple to containers specifically, because some classes of faults can only be reproduced on "real" hardware. I also want to avoid the use of Docker in general if I can--so far it's been complex, fragile, and difficult to debug. It seems to break constantly for different people, and that puts a lot of extra work/stress on my plate.
I got it, Kyle. Thanks for the answer! So I'll close it.