Skip to content

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

Restore future in mock client calls so that interrupts are isolated from caller (#68408)

Dan Stone4b4776310990
diff --git a/test/metabase/test/http_client.clj b/test/metabase/test/http_client.clj
index 7f57c00aeb5..2205f42ca21 100644
--- a/test/metabase/test/http_client.clj
+++ b/test/metabase/test/http_client.clj
@@ -455,7 +455,12 @@
[& args]
(let [parsed (parse-http-client-args args)]
(log/trace parsed)
- (-mock-client parsed)))
+ ;; despite no timeout, it is still important to run the server logic in a future, to ensure any server-set .interrupted flag
+ ;; does not influence subsequent client calls.
+ (try
+ @(future (-mock-client parsed))
+ (catch java.util.concurrent.ExecutionException ex
+ (throw (ex-cause ex))))))
(defn client-real-response
"Identical to `real-client` except returns the full HTTP response map, not just the body of the response."