mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Teaching jepsen to run external programs
This commit is contained in:
parent
a893cd3fe6
commit
c506e3218b
@ -9,6 +9,5 @@
|
||||
:dependencies [[org.clojure/clojure "1.10.1"]
|
||||
[jepsen "0.2.3"]
|
||||
[zookeeper-clj "0.9.4"]
|
||||
[me.raynes/conch "0.8.0"]
|
||||
[org.apache.zookeeper/zookeeper "3.6.1" :exclusions [org.slf4j/slf4j-log4j12]]]
|
||||
:repl-options {:init-ns jepsen.clickhouse-keeper.main})
|
||||
|
@ -0,0 +1,39 @@
|
||||
(ns jepsen.clickhouse-keeper.bench
|
||||
(:require [clojure.tools.logging :refer :all]
|
||||
[jepsen
|
||||
[client :as client]])
|
||||
(:import (java.lang ProcessBuilder)
|
||||
(java.lang ProcessBuilder$Redirect)))
|
||||
|
||||
(defn exec-process-builder
|
||||
[command & args]
|
||||
(let [pbuilder (ProcessBuilder. (into-array (cons command args)))]
|
||||
(.redirectOutput pbuilder ProcessBuilder$Redirect/INHERIT)
|
||||
(.redirectError pbuilder ProcessBuilder$Redirect/INHERIT)
|
||||
(let [p (.start pbuilder)]
|
||||
(.waitFor p))))
|
||||
|
||||
(defrecord BenchClient [unused]
|
||||
client/Client
|
||||
(open! [this test node]
|
||||
this)
|
||||
|
||||
(setup! [this test]
|
||||
this)
|
||||
|
||||
(invoke! [this test op]
|
||||
(let [bench-opts (into [] (clojure.string/split (:bench-opts op) #" "))
|
||||
bench-path (:bench-path op)
|
||||
nodes (into [] (flatten (map (fn [x] (identity ["-h" (str x ":9181")])) (:nodes test))))
|
||||
all-args (concat [bench-path] bench-opts nodes)]
|
||||
(info "Running cmd" all-args)
|
||||
(apply exec-process-builder all-args)
|
||||
(assoc op :type :ok :value "ok")))
|
||||
|
||||
(teardown! [_ test])
|
||||
|
||||
(close! [_ test]))
|
||||
|
||||
(defn bench-client
|
||||
[]
|
||||
(BenchClient. nil))
|
@ -125,7 +125,10 @@ bool Runner::tryPushRequestInteractively(const Coordination::ZooKeeperRequestPtr
|
||||
void Runner::runBenchmark()
|
||||
{
|
||||
auto aux_connections = getConnections();
|
||||
|
||||
std::cerr << "Preparing to run\n";
|
||||
generator->startup(*aux_connections[0]);
|
||||
std::cerr << "Prepared\n";
|
||||
try
|
||||
{
|
||||
for (size_t i = 0; i < concurrency; ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user