Skip to content

Commit

Permalink
Merge pull request cockroachdb#33 from aliher1911/tc-nightly-jepsen-0…
Browse files Browse the repository at this point in the history
….1.19
  • Loading branch information
aliher1911 committed Nov 18, 2022
2 parents 3d7c345 + f89b518 commit 1150b38
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
10 changes: 5 additions & 5 deletions cockroachdb/project.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(defproject cockroachdb "0.1.0"
(defproject cockroachdb "0.2.0"
:description "Jepsen testing for CockroachDB"
:url "http://cockroachlabs.com/"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[jepsen "0.1.9-SNAPSHOT"]
[org.clojure/java.jdbc "0.6.1"]
[org.postgresql/postgresql "9.4.1211"]]
:dependencies [[org.clojure/clojure "1.10.0"]
[jepsen "0.1.19"]
[org.clojure/java.jdbc "0.7.12"]
[org.postgresql/postgresql "42.1.3"]]
:jvm-opts ["-Xmx12g"
"-XX:+UseConcMarkSweepGC"
"-XX:+UseParNewGC"
Expand Down
4 changes: 2 additions & 2 deletions cockroachdb/src/jepsen/cockroach/adya.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
[generator :as gen]
[independent :as independent]
[util :as util :refer [meh letr]]
[reconnect :as rc]
[adya :as adya]]
[reconnect :as rc]]
[jepsen.tests.adya :as adya]
[jepsen.checker.timeline :as timeline]
[jepsen.cockroach.client :as c]
[jepsen.cockroach.nemesis :as cln]
Expand Down
24 changes: 14 additions & 10 deletions cockroachdb/src/jepsen/cockroach/bank.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(ns jepsen.cockroach.bank
"Simulates transfers between bank accounts"
(:refer-clojure :exclude [test])
(:require [jepsen [cockroach :as cockroach]
(:require [jepsen
[cockroach :as cockroach]
[client :as client]
[checker :as checker]
[generator :as gen]
Expand All @@ -14,7 +15,6 @@
[clojure.core.reducers :as r]
[clojure.java.jdbc :as j]
[clojure.tools.logging :refer :all]
[knossos.model :as model]
[knossos.op :as op]))

(defrecord BankClient [tbl-created? n starting-balance conn]
Expand Down Expand Up @@ -113,22 +113,24 @@
"Balances must all be non-negative and sum to the model's total."
[]
(reify checker/Checker
(check [this test model history opts]
(let [bad-reads (->> history
(check [this test history opts]
(let [total (:total test)
n (:n test)
bad-reads (->> history
(r/filter op/ok?)
(r/filter #(= :read (:f %)))
(r/map (fn [op]
(let [balances (:value op)]
(cond (not= (:n model) (count balances))
(cond (not= n (count balances))
{:type :wrong-n
:expected (:n model)
:expected n
:found (count balances)
:op op}

(not= (:total model)
(not= total
(reduce + balances))
{:type :wrong-total
:expected (:total model)
:expected total
:found (reduce + balances)
:op op}

Expand Down Expand Up @@ -161,7 +163,8 @@
[opts]
(bank-test-base
(merge {:name "bank"
:model {:n 5 :total 50}
:n 5
:total 50
:client (BankClient. (atom false) 5 10 nil)}
opts)))

Expand Down Expand Up @@ -244,6 +247,7 @@
[opts]
(bank-test-base
(merge {:name "bank-multitable"
:model {:n 5 :total 50}
:n 5
:total 50
:client (MultiBankClient. (atom false) 5 10 nil)}
opts)))
3 changes: 1 addition & 2 deletions cockroachdb/src/jepsen/cockroach/comments.clj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
[clojure.core.reducers :as r]
[clojure.set :as set]
[clojure.tools.logging :refer :all]
[knossos.model :as model]
[knossos.op :as op]))

(def table-prefix "String prepended to all table names." "comment_")
Expand Down Expand Up @@ -90,7 +89,7 @@
(defn checker
[]
(reify checker/Checker
(check [this test model history opts]
(check [this test history opts]
; Determine first-order write precedence graph
(let [expected (loop [completed (sorted-set)
expected {}
Expand Down
3 changes: 1 addition & 2 deletions cockroachdb/src/jepsen/cockroach/monotonic.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
[clojure.java.jdbc :as j]
[clojure.set :as set]
[clojure.tools.logging :refer :all]
[knossos.model :as model]
[knossos.op :as op]))

(defn parse-row
Expand Down Expand Up @@ -170,7 +169,7 @@
per-process basis."
[linearizable global?]
(reify checker/Checker
(check [this test model history opts]
(check [this test history opts]
(let [add-values (->> history
(r/filter op/ok?)
(r/filter #(= :add (:f %)))
Expand Down
5 changes: 2 additions & 3 deletions cockroachdb/src/jepsen/cockroach/sequential.clj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
[clojure.core.reducers :as r]
[clojure.set :as set]
[clojure.tools.logging :refer :all]
[knossos.model :as model]
[knossos.op :as op]))

(def table-prefix "String prepended to all table names." "seq_")
Expand Down Expand Up @@ -98,7 +97,7 @@
(c/with-conn [c client]
(c/with-timeout
(doseq [t (table-names table-count)]
(j/execute! c [(str "drop table " t)])))))
(j/execute! c [(str "drop table if exists " t)])))))

(close! [this test]
(rc/close! client)))
Expand Down Expand Up @@ -140,7 +139,7 @@
(defn checker
[]
(reify checker/Checker
(check [this test model history opts]
(check [this test history opts]
(assert (integer? (:key-count test)))
(let [reads (->> history
(r/filter op/ok?)
Expand Down
5 changes: 2 additions & 3 deletions cockroachdb/src/jepsen/cockroach/sets.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
[clojure.core.reducers :as r]
[clojure.set :as set]
[clojure.tools.logging :refer :all]
[knossos.model :as model]
[knossos.op :as op]))

(defn check-sets
Expand All @@ -24,7 +23,7 @@
elements are unique."
[]
(reify checker/Checker
(check [this test model history opts]
(check [this test history opts]
(let [attempts (->> history
(r/filter op/invoke?)
(r/filter #(= :add (:f %)))
Expand Down Expand Up @@ -125,7 +124,7 @@
(teardown! [this test]
(c/with-timeout
(c/with-conn [c conn]
(j/execute! c ["drop table set"]))))
(j/execute! c ["drop table if exists set"]))))

(close! [this test]
(rc/close! conn)))
Expand Down

0 comments on commit 1150b38

Please sign in to comment.