aboutsummaryrefslogtreecommitdiff
path: root/script/jepsen.garage/src/jepsen
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-04-18 16:19:35 +0200
committerAlex Auvolat <alex@adnab.me>2023-10-18 12:03:11 +0200
commit70c1d3db46b3bbdfad55b61c29e346c629380a32 (patch)
treece52c97782a6be87c4c7f44e3d9bb3676f1445fe /script/jepsen.garage/src/jepsen
parentbc11701999ececdb4571119082945cbe86f098aa (diff)
downloadgarage-70c1d3db46b3bbdfad55b61c29e346c629380a32.tar.gz
garage-70c1d3db46b3bbdfad55b61c29e346c629380a32.zip
better match exceptions
Diffstat (limited to 'script/jepsen.garage/src/jepsen')
-rw-r--r--script/jepsen.garage/src/jepsen/garage.clj20
1 files changed, 11 insertions, 9 deletions
diff --git a/script/jepsen.garage/src/jepsen/garage.clj b/script/jepsen.garage/src/jepsen/garage.clj
index 26c58097..9d6f891e 100644
--- a/script/jepsen.garage/src/jepsen/garage.clj
+++ b/script/jepsen.garage/src/jepsen/garage.clj
@@ -9,6 +9,7 @@
[tests :as tests]]
[jepsen.control.util :as cu]
[jepsen.os.debian :as debian]
+ [slingshot.slingshot :refer [try+]]
[amazonica.aws.s3 :as s3]
[amazonica.aws.s3transfer :as s3transfer]))
@@ -101,13 +102,14 @@
(setup! [this test])
(invoke! [this test op]
(case (:f op)
- :get-object
- (let [value-bytes (try
- (-> (s3/get-object (:creds this) grg-bucket grg-object)
- :input-stream
- slurp)
- (catch Exception e nil))]
- (assoc op :type :ok, :value value-bytes))
+ :get-object (try+
+ (let [value
+ (-> (s3/get-object (:creds this) grg-bucket grg-object)
+ :input-stream
+ slurp)]
+ (assoc op :type :ok, :value value))
+ (catch (re-find #"Key not found" (.getMessage %)) ex
+ (assoc op :type :ok, :value nil)))
:put-object
(let [some-bytes (.getBytes (:value op) "UTF-8")
bytes-stream (java.io.ByteArrayInputStream. some-bytes)]
@@ -137,10 +139,10 @@
:os debian/os
:db (db "v0.8.2")
:client (Client. nil)
- :generator (->> (gen/mix [op-get op-put])
+ :generator (->> (gen/mix [op-get op-put op-del])
(gen/stagger 1)
(gen/nemesis nil)
- (gen/time-limit 15))}))
+ (gen/time-limit 20))}))
(defn -main
"Handles command line arguments. Can either run a test, or a web server for