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
13 lines
533 B
Clojure
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))))
|