aboutsummaryrefslogtreecommitdiff
path: root/script/jepsen.garage/src/jepsen/garage/reg.clj
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-10-18 17:51:34 +0200
committerAlex Auvolat <alex@adnab.me>2023-10-18 17:51:34 +0200
commitb3bf16ee27b061a3a091022e718b2994365f945c (patch)
treea628a6a1628ae8847093cadb95b5cc97940477b7 /script/jepsen.garage/src/jepsen/garage/reg.clj
parentddd3de7fcef2a2e05805766085c156d7fde9e12e (diff)
downloadgarage-b3bf16ee27b061a3a091022e718b2994365f945c.tar.gz
garage-b3bf16ee27b061a3a091022e718b2994365f945c.zip
make jepsen test more robust: handle errors and timeouts, fixed access key
Diffstat (limited to 'script/jepsen.garage/src/jepsen/garage/reg.clj')
-rw-r--r--script/jepsen.garage/src/jepsen/garage/reg.clj22
1 files changed, 14 insertions, 8 deletions
diff --git a/script/jepsen.garage/src/jepsen/garage/reg.clj b/script/jepsen.garage/src/jepsen/garage/reg.clj
index 3a2c1d55..d5404c6b 100644
--- a/script/jepsen.garage/src/jepsen/garage/reg.clj
+++ b/script/jepsen.garage/src/jepsen/garage/reg.clj
@@ -33,19 +33,25 @@
(let [[k v] (:value op)]
(case (:f op)
:read
- (let [value (s3/get (:creds this) k)]
- (assoc op :type :ok, :value (independent/tuple k value)))
+ (try+
+ (let [value (s3/get (:creds this) k)]
+ (assoc op :type :ok, :value (independent/tuple k value)))
+ (catch (re-find #"Unavailable" (.getMessage %)) ex
+ (assoc op :type :fail, :error [:s3-error (.getMessage ex)])))
:write
- (do
- (s3/put (:creds this) k v)
- (assoc op :type :ok)))))
+ (try+
+ (do
+ (s3/put (:creds this) k v)
+ (assoc op :type :ok))
+ (catch (re-find #"Unavailable" (.getMessage %)) ex
+ (assoc op :type :fail, :error [:s3-error (.getMessage ex)]))))))
(teardown! [this test])
(close! [this test]))
(defn workload
"Tests linearizable reads and writes"
[opts]
- {:client (RegClient. nil)
+ {:client (client/timeout 10 (RegClient. nil))
:checker (independent/checker
(checker/compose
{:linear (checker/linearizable
@@ -53,8 +59,8 @@
:algorithm :linear})
:timeline (timeline/html)}))
:generator (independent/concurrent-generator
- 10
- (range)
+ (/ (:concurrency opts) 10) ; divide threads in 10 groups
+ (range) ; working on 10 keys
(fn [k]
(->>
(gen/mix [op-get op-put op-del])