Skip to content

Instantly share code, notes, and snippets.

@DeCarabas
Created August 23, 2019 02:27
Show Gist options
  • Save DeCarabas/489da7b662b125666ef162152f8d3ec8 to your computer and use it in GitHub Desktop.
Save DeCarabas/489da7b662b125666ef162152f8d3ec8 to your computer and use it in GitHub Desktop.
Trying to work through the Jepsen tutorial but in dummy mode
(ns jepsen.dumbo
(:require [clojure.tools.logging :refer :all]
[clojure.string :as str]
[jepsen
[cli :as cli]
[control :as c]
[db :as db]
[tests :as tests]]
[jepsen.control.util :as cu]
[jepsen.os :as os]))
(def dir "/opt/etcd")
(defn dumbo-db
"Dumbo DB for a particular version."
[version]
(reify db/DB
(setup! [_ test node]
(info node "installing dumbo" version)
(c/su
(let [url (str "https://storage.googleapis.com/etcd/" version
"/etcd-" version "-linux-amd64.tar.gz")]
(cu/install-archive! url dir))))
(teardown! [_ test node]
(info node "tearing down dumbo"))))
(defn with-ssh-dummy
"Jam the dummy bit into the :ssh options.
Our environment does not allow us to actually SSH around, so all of our
testing will be done locally. Whee!"
[opts]
(assoc opts :ssh (assoc (:ssh opts) :dummy? true)))
(defn dumbo-test
"Given an options map from the command line runner (e.g. :nodes, :ssh,
:concurrency, ...), constructs a test map."
[opts]
(merge tests/noop-test
(with-ssh-dummy opts)
{:name "dumbo"
:os os/noop
:db (dumbo-db "v3.1.5")}))
(defn -main
"Handles command line arguments. Can either run a test, or a web server for
browsing results."
[& args]
(cli/run! (cli/single-test-cmd {:test-fn dumbo-test})
args))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment