一个分布式测试系统利器

来源:互联网 发布:windows激活工具有哪些 编辑:程序博客网 时间:2024/06/05 09:45

Create an EC2 instance

  1. Sign up for AWS
  2. In Services -> EC2, click “Launch Instance”
  3. Choose the 64 bit Debian Jessie image
  4. Hit review and launch

Save your SSH key pair!

Install Java

SSH into your instance and open /etc/apt/sources.list in your favorite editor. Add jessie-backports to the file:

deb http://ftp.debian.org/debian jessie-backports main

Now run sudo apt-get update, and install the following!

$ sudo apt-get install openjdk-8-jre openjdk-8-jre-headless libjna-java

Use Docker

You need to install docker and docker compose. Then spin up the containers:

$ git clone https://github.com/aphyr/jepsen && cd jepsen/docker$ ./up.sh$ docker exec -it jepsen-control bash

Write your test

Create a new Leiningen project:

$ lein new foo && cd foo

And edit src/jepsen/foo.clj — your first test! This does nothing!

(ns jepsen.zookeeper  (:require [jepsen.tests :as tests]))(defn zk-test  [version]  tests/noop-test)

Edit test/jepsen/foo_test.clj to look like this:

(ns jepsen.foo-test  (:require [clojure.test :refer :all]    [jepsen.core :as jepsen]    [jepsen.foo :as foo]))
(deftest a-test  (is (:valid? (:results (jepsen/run! (foo/foo "3.4.5+dfsg-2"))))))

That calls the test you just wrote (and passes it a version number).

Finally! Run your test:

$ lein test

And hopefully you get something that ends with:

Everything looks good! ヽ(‘ー`)ノ


原创粉丝点击