Skip to content

Commit

Permalink
Use ScalarDB SNAPSHOT versions in ScalarDB Jepsen test (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
brfrn169 authored Aug 4, 2023
1 parent 6445928 commit b92f2f1
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 47 deletions.
3 changes: 2 additions & 1 deletion scalardb/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
[cassandra "0.1.0-SNAPSHOT"]
[cc.qbits/alia "4.3.6"]
[cc.qbits/hayt "4.1.0"]]
:repositories {"sonartype" "https://oss.sonatype.org/content/repositories/snapshots/"}
:profiles {:dev {:dependencies [[tortue/spy "2.0.0"]]
:plugins [[lein-cloverage "1.1.2"]]}
:use-released {:dependencies [[com.scalar-labs/scalardb "3.7.0"
:use-released {:dependencies [[com.scalar-labs/scalardb "4.0.0-SNAPSHOT"
;; avoid the netty dependency issue
:exclusions [software.amazon.awssdk/*
com.oracle.database.jdbc/ojdbc8-production
Expand Down
12 changes: 6 additions & 6 deletions scalardb/test/scalardb/elle_append_2pc_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@
(reify
TwoPhaseCommitTransaction
(getId [_] "dummy-id")
(^Optional get [_ ^Get _] (throw (CrudException. "get failed")))
(^void put [_ ^Put _] (throw (CrudException. "put failed")))
(^void prepare [_] (throw (PreparationException. "preparation failed")))
(^void validate [_] (throw (ValidationException. "validation failed")))
(^void commit [_] (throw (CommitException. "commit failed")))
(^Optional get [_ ^Get _] (throw (CrudException. "get failed" nil)))
(^void put [_ ^Put _] (throw (CrudException. "put failed" nil)))
(^void prepare [_] (throw (PreparationException. "preparation failed" nil)))
(^void validate [_] (throw (ValidationException. "validation failed" nil)))
(^void commit [_] (throw (CommitException. "commit failed" nil)))
(^void rollback [_] (swap! rollback-count inc))))

(def mock-2pc-throws-unknown
Expand All @@ -84,7 +84,7 @@
(^void put [_ ^Put p] (mock-put p))
(^void prepare [_] (swap! prepare-count inc))
(^void validate [_] (swap! validate-count inc))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state")))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state" nil)))
(^void rollback [_] (swap! rollback-count inc))))

(deftest append-client-init-test
Expand Down
8 changes: 4 additions & 4 deletions scalardb/test/scalardb/elle_append_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@
(def mock-transaction-throws-exception
(reify
DistributedTransaction
(^Optional get [_ ^Get _] (throw (CrudException. "get failed")))
(^void put [_ ^Put _] (throw (CrudException. "put failed")))
(^void commit [_] (throw (CommitException. "commit failed")))))
(^Optional get [_ ^Get _] (throw (CrudException. "get failed" nil)))
(^void put [_ ^Put _] (throw (CrudException. "put failed" nil)))
(^void commit [_] (throw (CommitException. "commit failed" nil)))))

(def mock-transaction-throws-unknown
(reify
DistributedTransaction
(getId [_] "unknown-state-tx")
(^Optional get [_ ^Get g] (mock-get g))
(^void put [_ ^Put p] (mock-put p))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state")))))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state" nil)))))

(deftest append-client-init-test
(with-redefs [scalar/setup-transaction-tables (spy/spy)
Expand Down
12 changes: 6 additions & 6 deletions scalardb/test/scalardb/elle_write_read_2pc_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@
(reify
TwoPhaseCommitTransaction
(getId [_] "dummy-id")
(^Optional get [_ ^Get _] (throw (CrudException. "get failed")))
(^void put [_ ^Put _] (throw (CrudException. "put failed")))
(^void prepare [_] (throw (PreparationException. "preparation failed")))
(^void validate [_] (throw (ValidationException. "validation failed")))
(^void commit [_] (throw (CommitException. "commit failed")))
(^Optional get [_ ^Get _] (throw (CrudException. "get failed" nil)))
(^void put [_ ^Put _] (throw (CrudException. "put failed" nil)))
(^void prepare [_] (throw (PreparationException. "preparation failed" nil)))
(^void validate [_] (throw (ValidationException. "validation failed" nil)))
(^void commit [_] (throw (CommitException. "commit failed" nil)))
(^void rollback [_] (swap! rollback-count inc))))

(def mock-2pc-throws-unknown
Expand All @@ -84,7 +84,7 @@
(^void put [_ ^Put p] (mock-put p))
(^void prepare [_] (swap! prepare-count inc))
(^void validate [_] (swap! validate-count inc))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state")))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state" nil)))
(^void rollback [_] (swap! rollback-count inc))))

(deftest write-read-client-init-test
Expand Down
8 changes: 4 additions & 4 deletions scalardb/test/scalardb/elle_write_read_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@
(def mock-transaction-throws-exception
(reify
DistributedTransaction
(^Optional get [_ ^Get _] (throw (CrudException. "get failed")))
(^void put [_ ^Put _] (throw (CrudException. "put failed")))
(^void commit [_] (throw (CommitException. "commit failed")))))
(^Optional get [_ ^Get _] (throw (CrudException. "get failed" nil)))
(^void put [_ ^Put _] (throw (CrudException. "put failed" nil)))
(^void commit [_] (throw (CommitException. "commit failed" nil)))))

(def mock-transaction-throws-unknown
(reify
DistributedTransaction
(getId [_] "unknown-state-tx")
(^Optional get [_ ^Get g] (mock-get g))
(^void put [_ ^Put p] (mock-put p))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state")))))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state" nil)))))

(deftest write-read-client-init-test
(with-redefs [scalar/setup-transaction-tables (spy/spy)
Expand Down
18 changes: 9 additions & 9 deletions scalardb/test/scalardb/transfer_2pc_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
(def mock-transaction-throws-exception
(reify
DistributedTransaction
(^Optional get [_ ^Get _] (throw (CrudException. "get failed")))
(^void put [_ ^Put _] (throw (CrudException. "put failed")))
(^void commit [_] (throw (CommitException. "commit failed")))))
(^Optional get [_ ^Get _] (throw (CrudException. "get failed" nil)))
(^void put [_ ^Put _] (throw (CrudException. "put failed" nil)))
(^void commit [_] (throw (CommitException. "commit failed" nil)))))

(def mock-2pc
(reify
Expand All @@ -90,11 +90,11 @@
(reify
TwoPhaseCommitTransaction
(getId [_] "dummy-id")
(^Optional get [_ ^Get _] (throw (CrudException. "get failed")))
(^void put [_ ^Put _] (throw (CrudException. "put failed")))
(^void prepare [_] (throw (PreparationException. "preparation failed")))
(^void validate [_] (throw (ValidationException. "validation failed")))
(^void commit [_] (throw (CommitException. "commit failed")))
(^Optional get [_ ^Get _] (throw (CrudException. "get failed" nil)))
(^void put [_ ^Put _] (throw (CrudException. "put failed" nil)))
(^void prepare [_] (throw (PreparationException. "preparation failed" nil)))
(^void validate [_] (throw (ValidationException. "validation failed" nil)))
(^void commit [_] (throw (CommitException. "commit failed" nil)))
(^void rollback [_] (swap! rollback-count inc))))

(def mock-2pc-throws-unknown
Expand All @@ -105,7 +105,7 @@
(^void put [_ ^Put p] (mock-put p))
(^void prepare [_] (swap! prepare-count inc))
(^void validate [_] (swap! validate-count inc))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state")))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state" nil)))
(^void rollback [_] (swap! rollback-count inc))))

(deftest transfer-client-init-test
Expand Down
18 changes: 9 additions & 9 deletions scalardb/test/scalardb/transfer_append_2pc_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
(def mock-transaction-throws-exception
(reify
DistributedTransaction
(^java.util.List scan [_ ^Scan _] (throw (CrudException. "scan failed")))
(^void put [_ ^Put _] (throw (CrudException. "put failed")))
(^void commit [_] (throw (CommitException. "commit failed")))))
(^java.util.List scan [_ ^Scan _] (throw (CrudException. "scan failed" nil)))
(^void put [_ ^Put _] (throw (CrudException. "put failed" nil)))
(^void commit [_] (throw (CommitException. "commit failed" nil)))))

(def mock-2pc
(reify
Expand All @@ -93,11 +93,11 @@
(reify
TwoPhaseCommitTransaction
(getId [_] "dummy-id")
(^java.util.List scan [_ ^Scan _] (throw (CrudException. "scan failed")))
(^void put [_ ^Put _] (throw (CrudException. "put failed")))
(^void prepare [_] (throw (PreparationException. "preparation failed")))
(^void validate [_] (throw (ValidationException. "validation failed")))
(^void commit [_] (throw (CommitException. "commit failed")))
(^java.util.List scan [_ ^Scan _] (throw (CrudException. "scan failed" nil)))
(^void put [_ ^Put _] (throw (CrudException. "put failed" nil)))
(^void prepare [_] (throw (PreparationException. "preparation failed" nil)))
(^void validate [_] (throw (ValidationException. "validation failed" nil)))
(^void commit [_] (throw (CommitException. "commit failed" nil)))
(^void rollback [_] (swap! rollback-count inc))))

(def mock-2pc-throws-unknown
Expand All @@ -108,7 +108,7 @@
(^void put [_ ^Put p] (mock-put p))
(^void prepare [_] (swap! prepare-count inc))
(^void validate [_] (swap! validate-count inc))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state")))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state" nil)))
(^void rollback [_] (swap! rollback-count inc))))

(deftest transfer-client-init-test
Expand Down
8 changes: 4 additions & 4 deletions scalardb/test/scalardb/transfer_append_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@
(def mock-transaction-throws-exception
(reify
DistributedTransaction
(^java.util.List scan [_ ^Scan _] (throw (CrudException. "scan failed")))
(^void put [_ ^Put _] (throw (CrudException. "put failed")))
(^void commit [_] (throw (CommitException. "commit failed")))))
(^java.util.List scan [_ ^Scan _] (throw (CrudException. "scan failed" nil)))
(^void put [_ ^Put _] (throw (CrudException. "put failed" nil)))
(^void commit [_] (throw (CommitException. "commit failed" nil)))))

(def mock-transaction-throws-unknown
(reify
DistributedTransaction
(getId [_] "unknown-state-tx")
(^java.util.List scan [_ ^Scan s] (mock-scan s))
(^void put [_ ^Put p] (mock-put p))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state")))))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state" nil)))))

(deftest transfer-client-init-test
(binding [test-records (atom {})
Expand Down
8 changes: 4 additions & 4 deletions scalardb/test/scalardb/transfer_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@
(def mock-transaction-throws-exception
(reify
DistributedTransaction
(^Optional get [_ ^Get _] (throw (CrudException. "get failed")))
(^void put [_ ^Put _] (throw (CrudException. "put failed")))
(^void commit [_] (throw (CommitException. "commit failed")))))
(^Optional get [_ ^Get _] (throw (CrudException. "get failed" nil)))
(^void put [_ ^Put _] (throw (CrudException. "put failed" nil)))
(^void commit [_] (throw (CommitException. "commit failed" nil)))))

(def mock-transaction-throws-unknown
(reify
DistributedTransaction
(getId [_] "unknown-state-tx")
(^Optional get [_ ^Get g] (mock-get g))
(^void put [_ ^Put p] (mock-put p))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state")))))
(^void commit [_] (throw (UnknownTransactionStatusException. "unknown state" nil)))))

(deftest transfer-client-init-test
(binding [test-records (atom {0 0 1 0 2 0 3 0 4 0})
Expand Down

0 comments on commit b92f2f1

Please sign in to comment.