Skip to content

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

Fix broken backend test assertions (#78902)

Nemanja Glumac3fd695cba690
diff --git a/test/metabase/dashboards_rest/api_test.clj b/test/metabase/dashboards_rest/api_test.clj
index 77ba1c6dce1..f86891325bf 100644
--- a/test/metabase/dashboards_rest/api_test.clj
+++ b/test/metabase/dashboards_rest/api_test.clj
@@ -829,7 +829,7 @@
(mt/with-log-messages-for-level [messages [metabase.parameters.params :trace]]
(is (some? (mt/user-http-request :rasta :get 200 (str "dashboard/" dash-id))))
(is (=? [{:level :trace
- :message "Could not find matching Field ID for target: \"not-existed-filter\""}]
+ :message "Could not find matching Field ID for target template tag"}]
(messages)))))))
;;; +----------------------------------------------------------------------------------------------------------------+
diff --git a/test/metabase/driver_test.clj b/test/metabase/driver_test.clj
index 20a1ba5c313..5b7974722a0 100644
--- a/test/metabase/driver_test.clj
+++ b/test/metabase/driver_test.clj
@@ -153,9 +153,8 @@
(#'task.sync-databases/sync-and-analyze-database*! (u/the-id db))
(some?
(some
- (fn [{:keys [level e message]}]
+ (fn [{:keys [level message]}]
(and (= level :warn)
- (instance? clojure.lang.ExceptionInfo e)
(re-matches #"^Cannot sync Database ([\s\S]+): ([\s\S]+)" message)))
(messages)))))]
(testing "sense checks before deleting the database"
diff --git a/test/metabase/transforms/util_test.clj b/test/metabase/transforms/util_test.clj
index 266912b3a81..f085dbd1724 100644
--- a/test/metabase/transforms/util_test.clj
+++ b/test/metabase/transforms/util_test.clj
@@ -436,7 +436,11 @@
Proved via a mock Statement so the test is deterministic and independent of any driver's enforcement
semantics."
(let [captured-seconds (atom nil)
+ ;; `set-query-timeout!` reads the Statement's Connection to decide whether the driver would
+ ;; send MariaDB-only syntax; an unimplemented `getConnection` would throw before the timeout
+ ;; is ever set. A nil Connection makes that check fall through to "timeouts work".
mock-stmt (proxy [java.sql.Statement] []
+ (getConnection [] nil)
(setQueryTimeout [secs] (reset! captured-seconds secs)))
set-timeout! @#'sql-jdbc.execute/set-statement-query-timeout!]
(testing "default dynamic scope"
@@ -449,6 +453,7 @@
(is (= (* 90 60) @captured-seconds))))
(testing "a throwing driver does not propagate the exception"
(let [throwing-stmt (proxy [java.sql.Statement] []
+ (getConnection [] nil)
(setQueryTimeout [_] (throw (java.sql.SQLFeatureNotSupportedException.))))]
(is (nil? (set-timeout! :h2 throwing-stmt)))))
(testing "drivers that opt out via :jdbc/set-query-timeout=false skip the call entirely"
diff --git a/test/metabase/warehouses_rest/api_test.clj b/test/metabase/warehouses_rest/api_test.clj
index 7e0a45d3fa2..780d3d2d58d 100644
--- a/test/metabase/warehouses_rest/api_test.clj
+++ b/test/metabase/warehouses_rest/api_test.clj
@@ -2595,7 +2595,8 @@
(testing "does not includes undefined keys by default"
(is (not (contains? (:settings (mt/user-http-request :crowberto :get 200 (str "database/" db-id)))
:undefined-setting))))
- (is (= "Error checking the readability of :undefined-setting setting. The setting will be hidden in API response."
+ (is (= (str "Error checking the readability of :undefined-setting setting. The setting will be hidden in API response."
+ " Error: Unknown setting: :undefined-setting")
(-> (messages)
first
:message)))))))