 
 (defn test-cluster [n]
   (let [c (create 8090 n)]
-    (update-in c [:servers "0.localnet:0" :election-timeout] (constantly 0))))
+    (assoc-in c [:servers "0.localnet:0" :election-timeout] 0)))
 
 (defn create-and-elect []
-  (until-empty (test-cluster 3)))
+  (until-empty (step 50 (until-empty (test-cluster 3)))))
 
 (deftest simple-things
   (testing "everyone's type"

                 (until-empty)
                 (step 150)
                 (until-empty))]
      (is (= '(1 1 1) (fields-by-id s :commit-index))))))

(deftest test-election-responses
  (testing "election with one server not responding"

      (is (= '(:leader :follower :follower) (fields-by-id s :type)))
      (is (= (list {:dst (s-at 1) :type :append-entries :src (s-at 0)
                    :body {:term 1 :leader-id (s-at 0)
                           :prev-log-index 1 :prev-log-term 0
                           :entries [{:term 1, :cmd {:op :noop}}] :leader-commit 0}}
                   {:dst (s-at 2) :type :append-entries :src (s-at 0)
                    :body {:term 1 :leader-id (s-at 0)
                           :prev-log-index 1 :prev-log-term 0
                           :entries [{:term 1, :cmd {:op :noop}}] :leader-commit 0}})
             (sort-by :dst (:tx-queue (srv s (s-at 0))))))
      (is (= {(s-at 2) 0 (s-at 1) 0} (:match-index (srv s (s-at 0)))))
      (is (= {(s-at 2) 2 (s-at 1) 2} (:next-index (srv s (s-at 0)))))))

  (testing "step 4 - process heart beat responses"
    (let [s (->> (test-cluster 3)
                 (step-times 0 4))]
      (is (= (list {:dst (s-at 0) :src (s-at 1) :type :append-entries-response
                :body {:term 1 :success true :count 1}}) (:tx-queue (srv s (s-at 1)))))
      (is (= (list {:dst (s-at 0) :src (s-at 2) :type :append-entries-response
                :body {:term 1 :success true :count 1}}) (:tx-queue (srv s (s-at 2)))))))
  (testing "step 5 - heart beat response"
    (let [s (->> (test-cluster 3)
                 (step-times 0 5))]
      (is (= {(s-at 2) 2 (s-at 1) 2} (:match-index (srv s (s-at 0)))))))


  (testing "step 7 wait for commit index"
