(defproject jepsen.etcdemo "0.1.0-SNAPSHOT"
:description "A Jepsen test for etcd"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:main jepsen.etcdemo
:dependencies [[org.clojure/clojure "1.10.0"]
[jepsen "0.2.1-SNAPSHOT"]
[verschlimmbesserung "0.1.3"]])
让我们先尝试用lein run来运行这个程序。
$leinrunException in thread "main" java.lang.Exception: Cannot find anything to run for: jepsen.etcdemo, compiling:(/tmp/form-init6673004597601163646.clj:1:73)
...
(ns jepsen.etcdemo)
(defn -main
"Handles command line arguments. Can either run a test, or a web server for
browsing results."
[& args]
(prn "Hello, world!" args))
(ns jepsen.etcdemo
(:require [jepsen.cli :as cli]
[jepsen.tests :as tests]))
(defn etcd-test
"Given an options map from the command line runner (e.g. :nodes, :ssh,
:concurrency, ...), constructs a test map."
[opts]
(merge tests/noop-test
{:pure-generators true}
opts))
(defn -main
"Handles command line arguments. Can either run a test, or a web server for
browsing results."
[& args]
(cli/run! (cli/single-test-cmd {:test-fn etcd-test})
args))
如果你当前依然在不断地遇到SSH错误,你应该检查下你的SSH是否代理正在运行并且已经加载了所有节点的密钥。ssh some-db-node应该可以不用密码就连接上数据库。你也可以在命令行上重写对应的用户名、密码和身份文件。详见lein run test --help。
$leinruntest--help#object[jepsen.cli$test_usage 0x7ddd84b5 jepsen.cli$test_usage@7ddd84b5]-h,--helpPrintoutthismessageandexit-n,--nodeHOSTNAME ["n1""n2""n3""n4""n5"]Node(s) torunteston--nodes-fileFILENAMEFilecontainingnodehostnames,oneperline.--usernameUSERrootUsernameforlogins--passwordPASSrootPasswordforsudoaccess--strict-host-key-checkingWhethertocheckhostkeys--ssh-private-keyFILEPathtoanSSHidentityfile --concurrency NUMBER 1n How many workers should we run? Must be an integer, optionally followed by n (e.g. 3n) to multiply by the number of nodes.
--test-countNUMBER1Howmanytimesshouldwerepeatatest? --time-limit SECONDS 60 Excluding setup and teardown, how long should a test run for, in seconds?
在本指导教程中,我们将全程使用lein run test ...来重新运行我们的Jepsen测试。每当我们运行一次测试,Jepsen将在store/下创建一个新目录。你可以在store/latest中看到最新的一次运行结果。
(defn -main
"Handles command line arguments. Can either run a test, or a web server for
browsing results."
[& args]
(cli/run! (merge (cli/single-test-cmd {:test-fn etcd-test})
(cli/serve-cmd))
args))