Skip to content

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

Add missing fixtures init (#82007)

Ben Grabowbeb22cd1b5c3
diff --git a/enterprise/backend/test/metabase_enterprise/sso/integrations/oidc_test.clj b/enterprise/backend/test/metabase_enterprise/sso/integrations/oidc_test.clj
index d621933f388..24ae06d8537 100644
--- a/enterprise/backend/test/metabase_enterprise/sso/integrations/oidc_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/sso/integrations/oidc_test.clj
@@ -17,7 +17,7 @@
(set! *warn-on-reflection* true)
-(use-fixtures :once (fixtures/initialize :test-users))
+(use-fixtures :once (fixtures/initialize :test-users :web-server))
(def ^:private test-encryption-key
"Test encryption key for OIDC state encryption."
diff --git a/enterprise/backend/test/metabase_enterprise/transforms/search_test.clj b/enterprise/backend/test/metabase_enterprise/transforms/search_test.clj
index c1d4b4600cf..6e2415497a0 100644
--- a/enterprise/backend/test/metabase_enterprise/transforms/search_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/transforms/search_test.clj
@@ -1,16 +1,19 @@
(ns metabase-enterprise.transforms.search-test
(:require
- [clojure.test :refer [deftest testing is]]
+ [clojure.test :refer [deftest is testing use-fixtures]]
[java-time.api :as t]
[metabase.app-db.core :as mdb]
[metabase.search.test-util :as search.tu]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[metabase.transforms.search-test :as search-test])
(:import
(org.postgresql.util PGobject)))
(set! *warn-on-reflection* true)
+(use-fixtures :once (fixtures/initialize :db))
+
(deftest transform-ingestion-test
(search.tu/with-temp-index-table
(testing "A simple Python transform gets properly ingested & indexed for search"
diff --git a/enterprise/backend/test/metabase_enterprise/transforms_python/models/python_library_test.clj b/enterprise/backend/test/metabase_enterprise/transforms_python/models/python_library_test.clj
index c6e71242ce6..5fae0000ae0 100644
--- a/enterprise/backend/test/metabase_enterprise/transforms_python/models/python_library_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/transforms_python/models/python_library_test.clj
@@ -2,10 +2,13 @@
(:require
[clojure.test :refer :all]
[metabase-enterprise.transforms-python.models.python-library :as python-library]
+ [metabase.test.fixtures :as fixtures]
[toucan2.core :as t2]))
(set! *warn-on-reflection* true)
+(use-fixtures :once (fixtures/initialize :db))
+
(deftest update-python-library-source-test
(testing "update-python-library-source!"
(testing "creates new record when none exists"
diff --git a/test/metabase/analytics/settings_test.clj b/test/metabase/analytics/settings_test.clj
index fe8e3702e39..add6e67abc3 100644
--- a/test/metabase/analytics/settings_test.clj
+++ b/test/metabase/analytics/settings_test.clj
@@ -3,11 +3,14 @@
[clojure.test :refer :all]
[metabase.analytics.settings :as analytics.settings]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[metabase.util.date-2 :as u.date]
[toucan2.core :as t2]))
(set! *warn-on-reflection* true)
+(use-fixtures :once (fixtures/initialize :db))
+
(deftest instance-creation-test
(let [original-value (t2/select-one-fn :value :model/Setting :key "instance-creation")]
(try
diff --git a/test/metabase/metabot/curation_test.clj b/test/metabase/metabot/curation_test.clj
index daa9a1b93d6..ddf49758f0d 100644
--- a/test/metabase/metabot/curation_test.clj
+++ b/test/metabase/metabot/curation_test.clj
@@ -6,8 +6,11 @@
[metabase.search.core :as search]
[metabase.search.test-util :as search.tu]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[toucan2.core :as t2]))
+(use-fixtures :once (fixtures/initialize :db))
+
(deftest curated-ids-consistent-with-index-test
(testing "curated-ids reads the same verdict from source-of-truth tables that the search index
precomputes from the specs, so the two definitions stay consistent (BOT-1570)"
diff --git a/test/metabase/permissions/util_test.clj b/test/metabase/permissions/util_test.clj
index 35c61e6de83..55da25af6fb 100644
--- a/test/metabase/permissions/util_test.clj
+++ b/test/metabase/permissions/util_test.clj
@@ -5,8 +5,11 @@
[metabase.permissions.models.collection-permission-graph-revision :as collection-permission-graph-revision]
[metabase.permissions.util :as perms.u]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[toucan2.core :as t2]))
+(use-fixtures :once (fixtures/initialize :db))
+
(def ^:private valid-paths
[;; execution permissions
"/execute/"
diff --git a/test/metabase/query_processor/middleware/add_implicit_clauses_test.clj b/test/metabase/query_processor/middleware/add_implicit_clauses_test.clj
index 55273cf51f9..a9469a5ae70 100644
--- a/test/metabase/query_processor/middleware/add_implicit_clauses_test.clj
+++ b/test/metabase/query_processor/middleware/add_implicit_clauses_test.clj
@@ -14,7 +14,10 @@
[metabase.query-processor.middleware.add-implicit-clauses :as qp.add-implicit-clauses]
[metabase.query-processor.preprocess :as qp.preprocess]
[metabase.query-processor.test :as qp]
- [metabase.test :as mt]))
+ [metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]))
+
+(use-fixtures :once (fixtures/initialize :db))
(defn- add-implicit-clauses
([query]
diff --git a/test/metabase/query_processor/middleware/add_implicit_joins_test.clj b/test/metabase/query_processor/middleware/add_implicit_joins_test.clj
index 0d678ed7054..43d928d0bf4 100644
--- a/test/metabase/query_processor/middleware/add_implicit_joins_test.clj
+++ b/test/metabase/query_processor/middleware/add_implicit_joins_test.clj
@@ -18,9 +18,12 @@
[metabase.query-processor.schema :as qp.schema]
[metabase.query-processor.test :as qp]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[metabase.util :as u]
[metabase.util.malli :as mu]))
+(use-fixtures :once (fixtures/initialize :db))
+
(deftest ^:parallel fk-field-infos->joins-test
(is (=? [{:lib/type :mbql/join
:stages [{:source-table (meta/id :products)}]
diff --git a/test/metabase/query_processor/middleware/annotate_test.clj b/test/metabase/query_processor/middleware/annotate_test.clj
index adc1fdfdac8..e1945b6d712 100644
--- a/test/metabase/query_processor/middleware/annotate_test.clj
+++ b/test/metabase/query_processor/middleware/annotate_test.clj
@@ -15,11 +15,14 @@
;; binds mock metadata providers via the ambient store, which the code under test reads
^{:clj-kondo/ignore [:deprecated-namespace]} [metabase.query-processor.store :as qp.store]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[metabase.util :as u]
[metabase.util.malli :as mu]))
(set! *warn-on-reflection* true)
+(use-fixtures :once (fixtures/initialize :db))
+
(deftest ^:parallel needs-type-inference?-test
(is (#'annotate/needs-type-inference?
{:lib/type :mbql/query, :stages [{:lib/type :mbql.stage/native}]}
diff --git a/test/metabase/query_processor/middleware/binning_test.clj b/test/metabase/query_processor/middleware/binning_test.clj
index 2bab8f3b475..b77f6eeb70c 100644
--- a/test/metabase/query_processor/middleware/binning_test.clj
+++ b/test/metabase/query_processor/middleware/binning_test.clj
@@ -17,7 +17,10 @@
;; binds mock metadata providers via the ambient store, which the code under test reads
^{:clj-kondo/ignore [:deprecated-namespace]} [metabase.query-processor.store :as qp.store]
[metabase.query-processor.test :as qp]
- [metabase.test :as mt]))
+ [metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]))
+
+(use-fixtures :once (fixtures/initialize :db))
;; Unit tests for bounds extraction live in [[metabase.lib.binning.util-test]].
diff --git a/test/metabase/query_processor/middleware/parameters/native_test.clj b/test/metabase/query_processor/middleware/parameters/native_test.clj
index 202e1a7d1a7..a31c8785ae0 100644
--- a/test/metabase/query_processor/middleware/parameters/native_test.clj
+++ b/test/metabase/query_processor/middleware/parameters/native_test.clj
@@ -9,8 +9,11 @@
[metabase.lib.test-util.macros :as lib.tu.macros]
[metabase.query-processor.middleware.parameters.native :as qp.native]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[metabase.util.malli.schema :as ms]))
+(use-fixtures :once (fixtures/initialize :db))
+
(deftest ^:parallel include-card-parameters-test
(testing "Expanding a Card reference in a native query should include its parameters (#12236)"
(let [mp (lib.tu/mock-metadata-provider
diff --git a/test/metabase/query_processor/middleware/resolve_joins_test.clj b/test/metabase/query_processor/middleware/resolve_joins_test.clj
index e1ec9dac8bb..6beb2842543 100644
--- a/test/metabase/query_processor/middleware/resolve_joins_test.clj
+++ b/test/metabase/query_processor/middleware/resolve_joins_test.clj
@@ -7,7 +7,10 @@
[metabase.lib.test-util :as lib.tu]
[metabase.lib.test-util.macros :as lib.tu.macros]
[metabase.query-processor.middleware.resolve-joins :as resolve-joins]
- [metabase.query-processor.preprocess :as qp.preprocess]))
+ [metabase.query-processor.preprocess :as qp.preprocess]
+ [metabase.test.fixtures :as fixtures]))
+
+(use-fixtures :once (fixtures/initialize :db))
(defn- resolve-joins
([query]
diff --git a/test/metabase/query_processor/util/add_alias_info_test.clj b/test/metabase/query_processor/util/add_alias_info_test.clj
index 0214c61fbee..a2d11b1abd1 100644
--- a/test/metabase/query_processor/util/add_alias_info_test.clj
+++ b/test/metabase/query_processor/util/add_alias_info_test.clj
@@ -20,10 +20,13 @@
^{:clj-kondo/ignore [:deprecated-namespace]} [metabase.query-processor.store :as qp.store]
[metabase.query-processor.util.add-alias-info :as add]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[metabase.util.match :as match]))
(comment h2/keep-me)
+(use-fixtures :once (fixtures/initialize :db))
+
(defn- remove-source-metadata
"This is mostly to make the test failure diffs sane."
[x]
diff --git a/test/metabase/query_processor/util/nest_query_test.clj b/test/metabase/query_processor/util/nest_query_test.clj
index 3dd48036c2c..0f4e3710140 100644
--- a/test/metabase/query_processor/util/nest_query_test.clj
+++ b/test/metabase/query_processor/util/nest_query_test.clj
@@ -13,7 +13,10 @@
[metabase.query-processor.test :as qp]
[metabase.query-processor.util.add-alias-info :as add]
[metabase.query-processor.util.nest-query :as nest-query]
- [metabase.test :as mt]))
+ [metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]))
+
+(use-fixtures :once (fixtures/initialize :db))
(defn- nest-expressions-mbql5 [query]
(driver/with-driver (or driver/*driver* :h2)
diff --git a/test/metabase/search/debug_test.clj b/test/metabase/search/debug_test.clj
index a431ec59468..2491ba16f7e 100644
--- a/test/metabase/search/debug_test.clj
+++ b/test/metabase/search/debug_test.clj
@@ -10,8 +10,11 @@
[metabase.search.ingestion :as search.ingestion]
[metabase.search.test-util :as search.tu]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[toucan2.core :as t2]))
+(use-fixtures :once (fixtures/initialize :db))
+
(use-fixtures :each (fn [thunk]
(binding [search.ingestion/*force-sync* true]
(thunk))))
diff --git a/test/metabase/search/models/search_index_metadata_test.clj b/test/metabase/search/models/search_index_metadata_test.clj
index 94f8b3417d6..1f1b0f3b7bf 100644
--- a/test/metabase/search/models/search_index_metadata_test.clj
+++ b/test/metabase/search/models/search_index_metadata_test.clj
@@ -4,10 +4,13 @@
[java-time.api :as t]
[metabase.search.models.search-index-metadata :as search-index-metadata]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[metabase.util :as u]
[toucan2.connection :as t2.connection]
[toucan2.core :as t2]))
+(use-fixtures :once (fixtures/initialize :db))
+
(deftest lifecycle-test
(t2/with-transaction [_ t2.connection/*current-connectable* {:rollback-only true}]
(let [engine :something-futureproof
diff --git a/test/metabase/sync/util_test.clj b/test/metabase/sync/util_test.clj
index 6daabd02f43..a4197e7d532 100644
--- a/test/metabase/sync/util_test.clj
+++ b/test/metabase/sync/util_test.clj
@@ -14,11 +14,14 @@
[metabase.sync.util :as sync-util]
[metabase.task-history.models.task-history :as task-history]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[metabase.test.util :as tu]
[toucan2.core :as t2]))
(set! *warn-on-reflection* true)
+(use-fixtures :once (fixtures/initialize :db))
+
;;; +----------------------------------------------------------------------------------------------------------------+
;;; | Duplicate Sync Prevention |
;;; +----------------------------------------------------------------------------------------------------------------+
diff --git a/test/metabase/typed_schemas/schema/metric_test.clj b/test/metabase/typed_schemas/schema/metric_test.clj
index 382b511acf6..bba572b96a3 100644
--- a/test/metabase/typed_schemas/schema/metric_test.clj
+++ b/test/metabase/typed_schemas/schema/metric_test.clj
@@ -4,10 +4,13 @@
[metabase.metabot.core :as metabot]
[metabase.models.interface :as mi]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[metabase.typed-schemas.schema.metric :as schema.metric]
[metabase.typed-schemas.schema.table :as schema.table]
[toucan2.core :as t2]))
+(use-fixtures :once (fixtures/initialize :db))
+
(deftest ^:parallel metric-dimension-schema-uses-dimension-id-test
(is (= {:type "column"
:name "category"
diff --git a/test/metabase/version/settings_test.clj b/test/metabase/version/settings_test.clj
index b3fa8181b72..120d83c90da 100644
--- a/test/metabase/version/settings_test.clj
+++ b/test/metabase/version/settings_test.clj
@@ -3,8 +3,11 @@
[clojure.test :refer :all]
[metabase.config.core :as config]
[metabase.test :as mt]
+ [metabase.test.fixtures :as fixtures]
[metabase.version.settings :as version.settings]))
+(use-fixtures :once (fixtures/initialize :db))
+
(def prevent? #'version.settings/prevent-upgrade?)
(deftest upgrade-threshold-test