jepsen-io / jepsen

A framework for distributed systems verification, with fault injection
6.68k stars 710 forks source link

[Raw idea] Integrate Jepsen with test-containers and manage Docker right in DB object #517

Closed ligurio closed 2 years ago

ligurio commented 2 years ago

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)
  1. https://github.com/jepsen-io/jepsen#docker
  2. https://clojars.org/clj-test-containers
  3. https://cljdoc.org/d/clj-test-containers/clj-test-containers/0.5.0/doc/readme
aphyr commented 2 years ago

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.

ligurio commented 2 years ago

I got it, Kyle. Thanks for the answer! So I'll close it.