aboutsummaryrefslogtreecommitdiff
path: root/script/jepsen.garage/src/jepsen/garage
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-04-19 16:16:34 +0200
committerAlex Auvolat <alex@adnab.me>2023-10-18 12:03:11 +0200
commit55eb4e87c42bf0da88186eb5b2fe1fbbbdf9ed43 (patch)
tree162e7ed86d4d4b33ac529982bdc7b27e95a440fc /script/jepsen.garage/src/jepsen/garage
parent0bb1577ae12b2dde313e036399f252266bc04d0a (diff)
downloadgarage-55eb4e87c42bf0da88186eb5b2fe1fbbbdf9ed43.tar.gz
garage-55eb4e87c42bf0da88186eb5b2fe1fbbbdf9ed43.zip
set tests with independant tests together
Diffstat (limited to 'script/jepsen.garage/src/jepsen/garage')
-rw-r--r--script/jepsen.garage/src/jepsen/garage/set.clj55
1 files changed, 35 insertions, 20 deletions
diff --git a/script/jepsen.garage/src/jepsen/garage/set.clj b/script/jepsen.garage/src/jepsen/garage/set.clj
index f8c92580..156493bc 100644
--- a/script/jepsen.garage/src/jepsen/garage/set.clj
+++ b/script/jepsen.garage/src/jepsen/garage/set.clj
@@ -28,14 +28,18 @@
(assoc this :creds creds)))
(setup! [this test])
(invoke! [this test op]
- (case (:f op)
- :add
- (do
- (grg/s3-put (:creds this) (str (:value op)) "present")
- (assoc op :type :ok))
- :read
- (let [items (grg/s3-list (:creds this) "")]
- (assoc op :type :ok, :value (set (map read-string items))))))
+ (let [[k v] (:value op)
+ prefix (str "set" k "/")]
+ (case (:f op)
+ :add
+ (do
+ (grg/s3-put (:creds this) (str prefix v) "present")
+ (assoc op :type :ok))
+ :read
+ (let [items (grg/s3-list (:creds this) prefix)
+ items-stripped (map (fn [o] (str/replace-first o prefix "")) items)
+ items-set (set (map read-string items-stripped))]
+ (assoc op :type :ok, :value (independent/tuple k items-set))))))
(teardown! [this test])
(close! [this test]))
@@ -43,22 +47,33 @@
"Tests insertions and deletions"
[opts]
{:client (SetClient. nil)
- :checker (checker/compose
- {:set (checker/set)
- :timeline (timeline/html)})
- ; :generator (gen/mix [op-add op-read])
- :generator (->> (range)
- (map (fn [x] {:type :invoke, :f :add, :value x})))
- :final-generator (gen/once op-read)})
+ :checker (independent/checker
+ (checker/compose
+ {:set (checker/set)
+ :timeline (timeline/html)}))
+ :generator (independent/concurrent-generator
+ 10
+ (range 100)
+ (fn [k]
+ (->>
+ (gen/mix [op-add])
+ (gen/limit (:ops-per-key opts)))))
+ :final-generator (independent/sequential-generator
+ (range 100)
+ (fn [k] (gen/once op-read)))})
(defn workload2
"Tests insertions and deletions"
[opts]
{:client (SetClient. nil)
- :checker (checker/compose
- {:set (checker/set-full {:linearizable? false})
- :timeline (timeline/html)})
- :generator (gen/mix [op-read
- (->> (range) (map (fn [x] {:type :invoke, :f :add, :value x})))])})
+ :checker (independent/checker
+ (checker/compose
+ {:set (checker/set-full {:linearizable? false})
+ :timeline (timeline/html)}))
+ :generator (independent/concurrent-generator
+ 10
+ (range 100)
+ (fn [k]
+ (gen/mix [op-add op-read])))})