                                                           (Throwable.
                                                             "oops"))))))
           app               (tk/boot-services-with-config [test-service] {})
-          test-svc          (get-service app :ShutdownTestServiceWithFn)
-          main-thread       (future (tk/run-app app))]
+          test-svc          (get-service app :ShutdownTestServiceWithFn)]
       (is (false? @shutdown-called?))
       (test-fn test-svc)
       (is (thrown-with-msg?
-            java.util.concurrent.ExecutionException #"java.lang.Throwable: oops"
-            (deref main-thread)))
+            Throwable
+            #"oops"
+            (tk/run-app app)))
       (is (true? @shutdown-called?))))
 
   (defn bootstrap-and-validate-shutdown
     [services shutdown-called? expected-exception-message]
-    (let [app         (tk/boot-services-with-config services {})
-          main-thread (future (tk/run-app app))]
+    (let [app         (tk/boot-services-with-config services {})]
         (is (thrown-with-msg?
-              ExecutionException
+              Throwable
               expected-exception-message
-              (deref main-thread))
+              (tk/run-app app))
             "tk run-app did not die with expected exception.")
         (is (true? @shutdown-called?)
             "Service shutdown was not called.")))

                                                                   #(throw (RuntimeException. "uh oh"))
                                                                   (fn [ctxt] (reset! on-error-fn-called? true)))))
          app                 (bootstrap-services-with-empty-config [broken-service])
          test-svc            (get-service app :ShutdownTestServiceWithFn)
          main-thread         (future (tk/run-app app))]
      (is (false? @shutdown-called?))
      (is (false? @on-error-fn-called?))
      (test-fn test-svc)
      (is (thrown-with-msg?
            java.util.concurrent.ExecutionException #"java.lang.RuntimeException: uh oh"
            (deref main-thread)))
      (is (true? @shutdown-called?))
      (is (true? @on-error-fn-called?))))


        (bootstrap-and-validate-shutdown
          [test-service]
          shutdown-called?
          #"oops")
        (is (logged? #"shutdown-on-error triggered because of exception!"
                     :error)
            "Error message for shutdown-on-error not logged."))))
