Arpith Siromoney 💬

Writing your first Jepsen test

Jepsen is a great library that lets you test distributed systems. I’m building a distributed database at the Recurse Center, and eventually want to run Jepsen on it. Here’s how you write a simple Jepsen test that does nothing!

Create an EC2 instance

  1. Sign up for AWS

  2. In Services -> EC2, click “Launch Instance”

  3. Choose the 64 bit Debian Jessie image

  4. Hit review and launch

Save your SSH key pair!

Install Java

SSH into your instance and open /etc/apt/sources.list in your favorite editor. Add jessie-backports to the file:

deb jessie-backports main

Now run sudo apt-get update, and install the following!

$ sudo apt-get install openjdk-8-jre openjdk-8-jre-headless libjna-java

Use Docker

You need to install docker and docker compose. Then spin up the containers:

$ git clone []( && cd jepsen/docker
$ ./
$ docker exec -it jepsen-control bash

Write your test

Create a new Leiningen project:

$ lein new foo && cd foo

And edit src/jepsen/foo.clj — your first test! This does nothing!

(ns jepsen.zookeeper
  (:require [jepsen.tests :as tests]))

(defn zk-test

Edit test/jepsen/foo_test.clj to look like this:

  (:require [clojure.test :refer :all]
    [jepsen.core :as jepsen]
    [ :as foo]))

(deftest a-test
  (is (:valid? (:results (jepsen/run! (foo/foo "3.4.5+dfsg-2"))))))

That calls the test you just wrote (and passes it a version number).

Finally! Run your test:

$ lein test

And hopefully you get something that ends with:

Everything looks good! ヽ(‘ー`)ノ

That’s it! Special thanks to James!

Hiring? Get in touch!