Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

fix: jetty stats handler tests flake (#63912)

Edward Pagete4a04ebc050d
diff --git a/.clj-kondo/config/test-helpers/config.edn b/.clj-kondo/config/test-helpers/config.edn
index 47064d07704..763c00643c7 100644
--- a/.clj-kondo/config/test-helpers/config.edn
+++ b/.clj-kondo/config/test-helpers/config.edn
@@ -13,7 +13,10 @@
toucan2.core/insert-returning-pk!
toucan2.core/insert-returning-pks!
clojure.core.async/<!!
+ clojure.core.async/<!
clojure.core.async/>!!
+ clojure.core.async/>!
+ clojure.core.async/alts!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/poll!
diff --git a/deps.edn b/deps.edn
index da8d2dcceeb..713c03773e5 100644
--- a/deps.edn
+++ b/deps.edn
@@ -284,6 +284,8 @@
"-Duser.country=US"
;; Allow clojure goes fast tooling to work
"-Djdk.attach.allowAttachSelf"
+ ;; have core.async report usages of blocking operations in go blocks
+ "-Dclojure.core.async.go-checking=true"
;; This will suppress the warning about dynamically loaded agents (like clj-memory-meter)
"-XX:+EnableDynamicAgentLoading"
;; set the logging properties set in `metabase.core.bootstrap`. calling (dev) will load it but
diff --git a/test/metabase/server/statistics_handler_test.clj b/test/metabase/server/statistics_handler_test.clj
index 2bc9baf45c5..10dd9f38087 100644
--- a/test/metabase/server/statistics_handler_test.clj
+++ b/test/metabase/server/statistics_handler_test.clj
@@ -18,7 +18,8 @@
[done-channel]
(proxy [AsyncListener] []
(onComplete [_]
- (a/>!! done-channel :done))))
+ (a/go
+ (a/>! done-channel :done)))))
(defn- async-servlet-handler
^ServletHandler [status-code chan-start-handle chan-finish-handle]
@@ -31,7 +32,7 @@
(.setStatus response status-code)
(.setContentLength response 0)
(.. response getOutputStream close)
- (a/<!! chan-finish-handle)
+ (a/<! chan-finish-handle)
(.complete async-context))
(a/<!! chan-finish-handle)))))
diff --git a/test/metabase/util/async_test.clj b/test/metabase/util/async_test.clj
index 29add9d2cbf..35801646da5 100644
--- a/test/metabase/util/async_test.clj
+++ b/test/metabase/util/async_test.clj
@@ -38,7 +38,7 @@
(a/>!! finished-chan e))))]
;; wait for `f` to actually start running before we kill it. Otherwise it may not get started at all
(a/go
- (a/alts!! [started-chan (a/timeout 1000)])
+ (a/alts! [started-chan (a/timeout 1000)])
(a/close! result-chan))
(is (instance?
InterruptedException