Skip to content

Latest commit

 

History

History
67 lines (51 loc) · 2.68 KB

README.md

File metadata and controls

67 lines (51 loc) · 2.68 KB

Dockerized Jepsen for MongoDB Testing

This docker image attempts to simplify the setup required by Jepsen. It is intended to be used by a CI tool or anyone with Docker who wants to try Jepsen themselves.

It contains all the jepsen dependencies and code. It uses Docker Compose to spin up the five containers used by Jepsen. A script builds a docker-compose.yml file out of fragments intemplate/, because this is the future, and using awk to generate YAML to generate computers is cloud native.

Customized Version for MongoDB Snapshot Isolation Testing

This docker-compose is derived from the version of jepsen. We make use of that and add many configurations and sripts to server the MongoDB Snapshot Isolation Testing.

It is IMPORTANT to note that the scripts should be run in the docker directory as what I mentioned in the Quickstart chapter. Ohterwise, the relationship among the directories may be destroyed.

Quickstart

Assuming you have docker-compose set up already, run:

bin/up
bin/console

... which will drop you into a console on the Jepsen control node.

Your DB nodes are n1, n2, n3, n4, and n5. You can open as many shells as you like using bin/console. If your test includes a web server (try lein run serve on the control node, in your test directory), you can open it locally by running using bin/web. This can be a handy way to browse test results.

Advanced

You can change the number of DB nodes by running (e.g.) bin/up -n 9.

If you need to log into a DB node (e.g. to debug a test), you can ssh n1 (or n2, n3, ...) from inside the control node, or:

docker exec -it jepsen-n1 bash

During development, it's convenient to run with --dev option, which mounts $JEPSEN_ROOT dir as /jepsen on Jepsen control container.

Run ./up.sh --help for more info.

Additional configration compared to the original version

Automatically set up the development environment

First you should set the environment variable $JEPSEN_ROOT as the development environment so that you can mount your development environment into jepsen-control. We provide bin/env.sh and call it in bin/up to set it automatically.

So you can moount this project into docker

bin/up --dev

Debugs

In some system, you may encouter this error

$ ./bin/up --dev
~/jepsen-txn-mongo/mongodb/docker ~/jepsen-txn-mongo/mongodb/docker
[INFO] Running docker-compose with dev config
./bin/up: 行 94: POSITIONAL[@]: 未绑定的变量

You can just replace this line in ./bin/up as follows

set -- "${POSITIONAL[@]-default}" # restore positional parameters