-
Notifications
You must be signed in to change notification settings - Fork 2
ci: enable jepsen tests by default #218
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| on: [ push ] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }}-jepsen-test | ||
|
|
||
| name: Jepsen Test | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| RUN_JEPSEN: 'true' | ||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| {: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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)))) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 4 months ago
To fix the issue, add a
permissionsblock specifying the minimum required permissions for the workflow. The best practice is to setcontents: readat either the workflow root or per-job basis. For this workflow, since the job does not require write permissions (no deployment, repository pushing, etc.), we can safely setcontents: readat the workflow root. This will limit the GITHUB_TOKEN permissions for all jobs that do not declare their own overrides. Edit.github/workflows/jepsen-test.ymlby inserting the following after thename:block and beforejobs:on line 7:This ensures the workflow runs with the principle of least privilege.