-
Notifications
You must be signed in to change notification settings - Fork 2
Add initial Jepsen test suite #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| on: [ push ] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }}-jepsen-test | ||
|
|
||
| name: Jepsen Test | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| RUN_JEPSEN: ${{ secrets.RUN_JEPSEN }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '21' | ||
| - name: Install Leiningen | ||
| run: | | ||
| curl -L https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > ~/lein | ||
| chmod +x ~/lein | ||
| ~/lein version | ||
| - name: Run Jepsen tests | ||
| if: env.RUN_JEPSEN == 'true' | ||
| working-directory: jepsen | ||
| run: ~/lein test | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| (defproject elastickv-jepsen "0.1.0-SNAPSHOT" | ||
| :description "Jepsen tests for Elastickv" | ||
| :repositories [["clojars" {:url "https://repo.clojars.org"}]] | ||
| :dependencies [[org.clojure/clojure "1.11.1"] | ||
| [jepsen "0.3.5"] | ||
| [redis.clients/jedis "5.1.0" :exclusions [org.slf4j/slf4j-api]] | ||
| [org.slf4j/slf4j-nop "2.0.9"]] | ||
| :main elastickv.jepsen-test) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| (ns elastickv.jepsen-test | ||
| (:gen-class) | ||
| (:require [jepsen | ||
| [core :as jepsen] | ||
| [cli :as cli] | ||
| [db :as db] | ||
| [client :as client] | ||
| [checker :as checker]] | ||
| [jepsen.checker.timeline :as timeline] | ||
| [jepsen.tests.linearizable-register :as register] | ||
| [jepsen.nemesis :as nemesis]) | ||
| (:import (redis.clients.jedis Jedis))) | ||
|
|
||
| (defrecord RedisClient [port] | ||
| client/Client | ||
| (open! [this test node] | ||
| (assoc this :conn (Jedis. (name node) port))) | ||
| (close! [this test] | ||
| (.close (:conn this)) | ||
| this) | ||
| (setup! [this test]) | ||
| (teardown! [this test]) | ||
| (invoke! [this test op] | ||
| (let [conn (:conn this) | ||
| value (:value op)] | ||
| (case (:f op) | ||
| :write (do (.set conn "k" (pr-str value)) | ||
| (assoc op :type :ok)) | ||
| :read (let [v (.get conn "k")] | ||
| (assoc op :type :ok | ||
| :value (when v (read-string v)))) | ||
| (assoc op :type :fail :error :unknown-op))))) | ||
|
|
||
| (defn elastickv-test [] | ||
| (register/test | ||
|
Comment on lines
+31
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P1] Jepsen workflow assumes a ready-made cluster The new Jepsen test defines nodes Useful? React with 👍 / 👎. |
||
| {:name "elastickv-register" | ||
| :nodes ["n1" "n2" "n3"] | ||
| :db db/noop | ||
| :client (->RedisClient 63791) | ||
| :concurrency 5 | ||
| :nemesis (nemesis/partition-random-halves)})) | ||
|
|
||
| (defn -main | ||
| [& args] | ||
| (cli/run! (cli/single-test-cmd {:test-fn elastickv-test}) args)) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| (ns elastickv.jepsen-test-test | ||
| (:require [clojure.test :refer :all] | ||
| [elastickv.jepsen-test :as jt])) | ||
|
|
||
| (deftest builds-test-spec | ||
| (is (map? (jt/elastickv-test)))) |
Uh oh!
There was an error while loading. Please reload this page.