Skip to content

Commit

Permalink
jepsen.core: properly run teardown on all nodes, update tests to match
Browse files Browse the repository at this point in the history
  • Loading branch information
aphyr committed Sep 28, 2020
1 parent 20fb335 commit 1b0eb1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion jepsen/src/jepsen/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
(try (client/teardown! c# ~test)
(finally
(client/close! c# ~test))))
(zipmap clients# (:nodes ~test))))
(map vector clients# (:nodes ~test))))
@nf#))))))

(defn run-case!
Expand Down
18 changes: 9 additions & 9 deletions jepsen/test/jepsen/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(:refer-clojure :exclude [run!])
(:use clojure.test)
(:require [clojure.string :as str]
[clojure.pprint :refer [pprint]]
[jepsen.core :refer :all]
[jepsen [common-test :refer [quiet-logging]]]
[jepsen.os :as os]
Expand Down Expand Up @@ -98,15 +99,14 @@
(is (= :done @state)))

(testing "client setup/teardown"
(let [setup (take 15 @meta-log)
run (->> @meta-log (drop 15) (drop-last 15))
teardown (take-last 15 @meta-log)]
(is (= {:open 5
:setup 5
:close 5}
(frequencies setup)))
(is (= {:open 10 :close 10} (frequencies run)))
(is (= {:open 5 :teardown 5 :close 5} (frequencies teardown)))))
(let [n (count (:nodes test))
n2 (* 2 n)
setup (take n2 @meta-log)
run (->> @meta-log (drop n2) (drop-last n2))
teardown (take-last n2 @meta-log)]
(is (= {:open n :setup n} (frequencies setup)))
(is (= {:open n2 :close n2} (frequencies run)))
(is (= {:teardown n :close n} (frequencies teardown)))))

(is (:valid? (:results test)))
(testing "first read"
Expand Down

0 comments on commit 1b0eb1b

Please sign in to comment.