mount/test/check/cleanup_dirty_states_test.clj
anatoly ead12a7e88 [#18]: cleaning up stale states
stale running instances are going into limbo on redefs
caused by recompiling namespaces with defstates, tn/refresh, tn/refresh-all, etc.

cleaning those stale instances with their stop functions before redefining their states
2015-11-30 13:00:56 -05:00

13 lines
533 B
Clojure

(ns check.cleanup_dirty_states_test
(:require [mount.core :as mount]
[app]
[clojure.test :refer :all]))
(deftest cleanup-dirty-states
(let [_ (mount/start)]
(is (not (.isClosed (:server-socket app/nrepl))))
(require 'app :reload)
(mount/start) ;; should not result in "BindException Address already in use" since the clean up will stop the previous instance
(is (not (.isClosed (:server-socket app/nrepl))))
(mount/stop)
(is (instance? mount.core.NotStartedState app/nrepl))))