             (Thread/yield)))
         (is (= 503 (:status (ping-environment)))))
        (jruby-protocol/return-instance jruby-service jruby-instance :i-want-this-instance)
-       @stop-complete?
+       (is (not= :timed-out (timed-deref stop-complete?))
+           "timed out waiting for the stop to complete")
        (let [app-context (tk-app/app-context app)]
          ;; We have to re-initialize the JRubyPuppetService here because
          ;; otherwise the tk-app/stop that is included in the

              ;; we are going to borrow and return a second instance until we get its
              ;; request count up to max-requests - 1, so that we can use it to test
              ;; flushing behavior the next time we return it.
              (borrow-until-desired-borrow-count jruby-service 9)
              ;; now we grab a reference to that instance and hold onto it for later.
              (let [instance2 (jruby-protocol/borrow-instance jruby-service
                                :max-requests-flush-while-pool-flush-in-progress-test)]

  (testing "During a shutdown requests result in 503 http responses"
    (bootstrap/with-puppetserver-running
     app
     {:jruby-puppet {:max-active-instances 2
                     :borrow-timeout default-borrow-timeout}}
     (let [jruby-service (tk-app/get-service app :JRubyPuppetService)
           context (tk-services/service-context jruby-service)
           jruby-instance (jruby-protocol/borrow-instance jruby-service :i-want-this-instance)
