ClickHouse/tests/jepsen.clickhouse-keeper/test/jepsen/keeper_test.clj

40 lines
1.4 KiB
Clojure
Raw Normal View History

2021-03-30 07:38:15 +00:00
(ns jepsen.keeper-test
(:require [clojure.test :refer :all]
2021-03-30 07:38:15 +00:00
[jepsen.clickhouse-keeper.utils :refer :all]
[zookeeper :as zk]
2021-03-19 18:53:09 +00:00
[zookeeper.data :as data])
(:import (ch.qos.logback.classic Level)
(org.slf4j Logger LoggerFactory)))
(defn multicreate
[conn]
(dorun (map (fn [v] (zk/create conn v :persistent? true)) (take 10 (zk-range)))))
(defn multidelete
[conn]
(dorun (map (fn [v] (zk/delete conn v)) (take 10 (zk-range)))))
(deftest a-test
2021-03-30 07:45:51 +00:00
(testing "keeper connection"
2021-03-19 18:53:09 +00:00
(.setLevel
(LoggerFactory/getLogger "org.apache.zookeeper") Level/OFF)
(let [conn (zk/connect "localhost:9181" :timeout-msec 5000)]
2021-03-18 20:55:11 +00:00
;(println (take 10 (zk-range)))
;(multidelete conn)
;(multicreate conn)
;(zk/create-all conn "/0")
;(zk/create conn "/0")
;(println (zk/children conn "/"))
;(zk/set-data conn "/0" (data/to-bytes "777") -1)
(println (zk-parent-path "/sasds/dasda/das"))
(println (zk-parent-path "/sasds"))
(zk-multi-create-many-seq-nodes conn "/a-" 5)
(println (zk/children conn "/"))
2021-03-18 20:55:11 +00:00
(println (zk-list-with-stat conn "/"))
(println (zk-multi-delete-first-child conn "/"))
(println (zk-list-with-stat conn "/"))
;(Thread/sleep 5000)
;(println "VALUE" (data/to-string (:data (zk/data conn "/0"))))
;(is (= (data/to-string (:data (zk/data conn "/0"))) "777"))
(zk/close conn))))