aboutsummaryrefslogtreecommitdiff
path: root/script/jepsen.garage/src/jepsen/garage/set.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/set.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/set.clj')
-rw-r--r--script/jepsen.garage/src/jepsen/garage/set.clj49
1 files changed, 28 insertions, 21 deletions
diff --git a/script/jepsen.garage/src/jepsen/garage/set.clj b/script/jepsen.garage/src/jepsen/garage/set.clj
index f625e672..670c73f2 100644
--- a/script/jepsen.garage/src/jepsen/garage/set.clj
+++ b/script/jepsen.garage/src/jepsen/garage/set.clj
@@ -30,27 +30,34 @@
(assoc this :creds (grg/creds node)))
(setup! [this test])
(invoke! [this test op]
- (let [[k v] (:value op)
- prefix (str "set" k "/")]
- (case (:f op)
- :add
- (util/timeout
- 10000
- (assoc op :type :info, :error ::timeout)
- (do
- (s3/put (:creds this) (str prefix v) "present")
- (assoc op :type :ok)))
- :read
- (util/timeout
- 10000
- (assoc op :type :fail, :error ::timeout)
- (do
- (let [items (s3/list (:creds this) prefix)]
- (let [items-stripped (map (fn [o]
- (assert (str/starts-with? o prefix))
- (str/replace-first o prefix "")) items)
- items-set (set (map parse-long items-stripped))]
- (assoc op :type :ok, :value (independent/tuple k items-set)))))))))
+ (try+
+ (let [[k v] (:value op)
+ prefix (str "set" k "/")]
+ (case (:f op)
+ :add
+ (util/timeout
+ 10000
+ (assoc op :type :info, :error ::timeout)
+ (do
+ (s3/put (:creds this) (str prefix v) "present")
+ (assoc op :type :ok)))
+ :read
+ (util/timeout
+ 10000
+ (assoc op :type :fail, :error ::timeout)
+ (do
+ (let [items (s3/list (:creds this) prefix)]
+ (let [items-stripped (map (fn [o]
+ (assert (str/starts-with? o prefix))
+ (str/replace-first o prefix "")) items)
+ items-set (set (map parse-long items-stripped))]
+ (assoc op :type :ok, :value (independent/tuple k items-set))))))))
+ (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]))