Skip to content
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

Custom configuration for ScalarDB tests #128

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions scalardb/src/scalardb/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
(com.scalar.db.schemaloader SchemaLoader)
(com.scalar.db.service TransactionFactory
StorageFactory)
(com.scalar.db.transaction.consensuscommit Coordinator)))
(com.scalar.db.transaction.consensuscommit Coordinator)
(java.io FileInputStream)
(java.util Properties)))

(def ^:const RETRIES 8)
(def ^:const RETRIES_FOR_RECONNECTION 3)
Expand Down Expand Up @@ -78,9 +80,18 @@
:primary-key [:tx_id]}})
(cassandra/close-cassandra cluster session)))

(defn- load-config
[test]
(when-let [path (and (seq (:config-file test)) (:config-file test))]
(let [props (Properties.)]
(with-open [stream (FileInputStream. path)]
(.load props stream))
props)))

(defn setup-transaction-tables
[test schemata]
(let [properties (ext/create-properties (:db test) test)
(let [properties (or (load-config test)
(ext/create-properties (:db test) test))
options (ext/create-table-opts (:db test) test)]
(if (= (.getProperty properties "scalar.db.username") "cassandra")
;; Workaround the issue of the schema loader for Cassandra
Expand Down
5 changes: 4 additions & 1 deletion scalardb/src/scalardb/runner.clj
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@

(cli/repeated-opt nil "--consistency-model CONSISTENCY_MODEL"
"consistency model to be checked"
["snapshot-isolation"])])
["snapshot-isolation"])

[nil "--config-file CONFIG_FILE" "ScalarDB config file. When this is given, other configuration options are ignored."
:default ""]])

(defn- test-name
[workload-key faults admin]
Expand Down
Loading