Skip to content

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

Fix race in detached-fetch!-sweeps-stalled-fetches-test (#82347)

Eric Normand615cfdb48bf4
diff --git a/test/metabase/warehouse_schema/models/field_values_test.clj b/test/metabase/warehouse_schema/models/field_values_test.clj
index 46c31f64d79..4a8518d3641 100644
--- a/test/metabase/warehouse_schema/models/field_values_test.clj
+++ b/test/metabase/warehouse_schema/models/field_values_test.clj
@@ -328,7 +328,9 @@
@release))
(catch Throwable _ ::threw)))]
@started
- (let [stalled-future @(:future-ref (get @registry ::stalled))]
+ ;; the registry entry exists before the fetch starts, but its future is stored just after
+ ;; submission, so `started` can fire before :future-ref is populated
+ (let [stalled-future (tu/poll-until 10000 @(:future-ref (get @registry ::stalled)))]
;; backdate the entry's timer so the next call through detached-fetch! sees it as stalled.
;; Backdating this one entry rather than shortening the max age keeps the sweep from
;; touching fetches other tests may have in flight.