Merge pull request #39992 from ClickHouse/fix-jepsen-counter-test

Use different root path for Jepsen Counter test
This commit is contained in:
Alexander Tokmakov 2022-08-11 21:38:10 +03:00 committed by GitHub
commit 4b4b5e91b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@
[zookeeper :as zk])
(:import (org.apache.zookeeper ZooKeeper KeeperException KeeperException$BadVersionException)))
(def root-path "/counter")
(defn r [_ _] {:type :invoke, :f :read})
(defn add [_ _] {:type :invoke, :f :add, :value (rand-int 5)})
@ -20,17 +21,19 @@
:conn (zk-connect node 9181 30000))
:nodename node))
(setup! [this test])
(setup! [this test]
(exec-with-retries 30 (fn []
(zk-create-if-not-exists conn root-path ""))))
(invoke! [this test op]
(case (:f op)
:read (exec-with-retries 30 (fn []
(assoc op
:type :ok
:value (count (zk-list conn "/")))))
:value (count (zk-list conn root-path)))))
:add (try
(do
(zk-multi-create-many-seq-nodes conn "/seq-" (:value op))
(zk-multi-create-many-seq-nodes conn (concat-path root-path "seq-") (:value op))
(assoc op :type :ok))
(catch Exception _ (assoc op :type :info, :error :connect-error)))))