aboutsummaryrefslogtreecommitdiff
path: root/script/jepsen.garage/src/jepsen/garage/reg.clj
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-10-25 11:41:34 +0200
committerAlex Auvolat <alex@adnab.me>2023-10-25 11:41:34 +0200
commitdb921cc05f8bcfccd0d0ba1d90b6dcd77f06dcdd (patch)
treee2dadcb33d8cdc6eae93cbf7819fae7693df35b5 /script/jepsen.garage/src/jepsen/garage/reg.clj
parent4fa2646a75ed9b4823bf36ae6218a18cca11c471 (diff)
downloadgarage-db921cc05f8bcfccd0d0ba1d90b6dcd77f06dcdd.tar.gz
garage-db921cc05f8bcfccd0d0ba1d90b6dcd77f06dcdd.zip
jepsen: reconfigure nemesis + add db nemesis
Diffstat (limited to 'script/jepsen.garage/src/jepsen/garage/reg.clj')
-rw-r--r--script/jepsen.garage/src/jepsen/garage/reg.clj37
1 files changed, 22 insertions, 15 deletions
diff --git a/script/jepsen.garage/src/jepsen/garage/reg.clj b/script/jepsen.garage/src/jepsen/garage/reg.clj
index 6772abfe..39708c0b 100644
--- a/script/jepsen.garage/src/jepsen/garage/reg.clj
+++ b/script/jepsen.garage/src/jepsen/garage/reg.clj
@@ -30,21 +30,28 @@
(assoc this :creds (grg/creds node)))
(setup! [this test])
(invoke! [this test op]
- (let [[k v] (:value op)]
- (case (:f op)
- :read
- (util/timeout
- 10000
- (assoc op :type :fail, :error ::timeout)
- (let [value (s3/get (:creds this) k)]
- (assoc op :type :ok, :value (independent/tuple k value))))
- :write
- (util/timeout
- 10000
- (assoc op :type :info, :error ::timeout)
- (do
- (s3/put (:creds this) k v)
- (assoc op :type :ok))))))
+ (try+
+ (let [[k v] (:value op)]
+ (case (:f op)
+ :read
+ (util/timeout
+ 10000
+ (assoc op :type :fail, :error ::timeout)
+ (let [value (s3/get (:creds this) k)]
+ (assoc op :type :ok, :value (independent/tuple k value))))
+ :write
+ (util/timeout
+ 10000
+ (assoc op :type :info, :error ::timeout)
+ (do
+ (s3/put (:creds this) k v)
+ (assoc op :type :ok)))))
+ (catch (re-find #"Unavailable" (.getMessage %)) ex
+ (assoc op :type :info, :error ::unavailable))
+ (catch (re-find #"Broken pipe" (.getMessage %)) ex
+ (assoc op :type :info, :error ::broken-pipe))
+ (catch (re-find #"Connection refused" (.getMessage %)) ex
+ (assoc op :type :info, :error ::connection-refused))))
(teardown! [this test])
(close! [this test]))