Skip to content

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

test: bump transform-run timeouts for slow drivers (#78202)

Nicola Momettofad1ba4fd786
diff --git a/test/metabase/transforms/jobs_test.clj b/test/metabase/transforms/jobs_test.clj
index a8287239760..8c50c564214 100644
--- a/test/metabase/transforms/jobs_test.clj
+++ b/test/metabase/transforms/jobs_test.clj
@@ -21,7 +21,7 @@
[metabase.transforms.models.transform-run :as transform-run]
[metabase.transforms.settings :as transforms.settings]
[metabase.transforms.test-dataset :as transforms-dataset]
- [metabase.transforms.test-util :refer [with-transform-cleanup!]]
+ [metabase.transforms.test-util :refer [transform-run-timeout-seconds with-transform-cleanup!]]
[metabase.transforms.util :as transforms.u]
[toucan2.core :as t2])
(:import
@@ -608,8 +608,10 @@
{:run-method :manual})}
(catch Exception e
{:error e})))
- results [(deref fut1 30000 {:error :timeout})
- (deref fut2 30000 {:error :timeout})]]
+ ;; each run-transforms! does a real transform execution, so give it the full run timeout
+ timeout-ms (* 1000 transform-run-timeout-seconds)
+ results [(deref fut1 timeout-ms {:error :timeout})
+ (deref fut2 timeout-ms {:error :timeout})]]
(is (every? #(= :succeeded (-> % :result ::jobs/status)) results)
"Both threads should succeed"))))))))))))))
diff --git a/test/metabase/transforms/test_util.clj b/test/metabase/transforms/test_util.clj
index df5f8475c75..e578ed9e9b9 100644
--- a/test/metabase/transforms/test_util.clj
+++ b/test/metabase/transforms/test_util.clj
@@ -16,6 +16,11 @@
(set! *warn-on-reflection* true)
+(def transform-run-timeout-seconds
+ "How long tests wait for a transform run to finish execution and sync."
+ ;; BigQuery runs routinely take 50-70s in CI.
+ 120)
+
(defn seconds-from-now-ns
"Returns a deadline `seconds` from now in nanoseconds, for use with `System/nanoTime`.
We use nanoTime rather than currentTimeMillis because it is monotonic and not affected by
@@ -174,7 +179,7 @@
(defn test-run
[transform-id]
(let [resp (mt/user-http-request :crowberto :post 202 (format "transform/%s/run" transform-id))
- timeout-s 20 ; 20 seconds is our timeout to finish execution and sync
+ timeout-s transform-run-timeout-seconds
deadline (seconds-from-now-ns timeout-s)]
(is (=? {:message "Transform run started"}
resp))
diff --git a/test/metabase/transforms_rest/api/transform_test.clj b/test/metabase/transforms_rest/api/transform_test.clj
index 0c750becb74..126546a6dad 100644
--- a/test/metabase/transforms_rest/api/transform_test.clj
+++ b/test/metabase/transforms_rest/api/transform_test.clj
@@ -25,6 +25,7 @@
parse-instant
seconds-from-now-ns
table-rows
+ transform-run-timeout-seconds
utc-timestamp
wait-for-table
with-transform-cleanup!]]
@@ -827,7 +828,7 @@
(mt/with-db-perm-for-group! (perms-group/all-users) (mt/id) :perms/transforms :yes
(mt/with-data-analyst-role! (mt/user->id :lucky)
(let [resp (mt/user-http-request :lucky :post 202 (format "transform/%s/run" transform-id))
- timeout-s 20 ; 20 seconds is our timeout to finish execution and sync
+ timeout-s transform-run-timeout-seconds
deadline (seconds-from-now-ns timeout-s)]
(is (=? {:message "Transform run started"}
resp))