Skip to content

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

Warn on large tests with several distinct testing blocks (#74802)

Cam Saul6cc99e6df55d
diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn
index 96101c53801..89e61c51aaa 100644
--- a/.clj-kondo/config.edn
+++ b/.clj-kondo/config.edn
@@ -205,6 +205,16 @@
{:level :warning
:max-length 150}
+ ;; Warn on long tests (tests over `:min-length`) that look like
+ ;;
+ ;; (deftest my-test
+ ;; (testing ...)
+ ;; (testing ...)
+ ;; (testing ...))
+ :metabase/validate-deftest-logically-separate-tests
+ {:level :warning
+ :min-length 60}
+
;; this is not enabled here, it is enabled below only for specific namespaces.
:metabase/disallow-hardcoded-driver-names-in-tests
;; don't include `:h2` since that will probably lead to a mountain of tests where we are specifically testing
diff --git a/.clj-kondo/src/hooks/clojure/test.clj b/.clj-kondo/src/hooks/clojure/test.clj
index 7ee67b2e501..422600bc00e 100644
--- a/.clj-kondo/src/hooks/clojure/test.clj
+++ b/.clj-kondo/src/hooks/clojure/test.clj
@@ -84,6 +84,36 @@
"Split it up into smaller tests! 🥰")
:type :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests)))))))
+(defn- every-top-level-form-in-deftest-is-testing? [{[_deftest _test-name & forms] :children, :as _node}]
+ (every? (fn [{[first-child] :children, :as form}]
+ (and (hooks/list-node? form)
+ (= (hooks.common/node->qualified-symbol first-child)
+ 'clojure.test/testing)))
+ forms))
+
+(defn- num-top-level-forms-in-deftest [{[_deftest _test-name & forms] :children, :as _node}]
+ (count forms))
+
+(defn- deftest-check-should-not-be-multiple-separate-tests
+ "Warn on long tests (tests over `min-length`) that look like
+
+ (deftest my-test
+ (testing ...)
+ (testing ...)
+ (testing ...))"
+ [node {:keys [min-length], :as _config}]
+ (let [{:keys [row end-row]} (meta node)
+ test-length (- end-row row)]
+ (when (and min-length
+ (> test-length min-length)
+ (every-top-level-form-in-deftest-is-testing? node)
+ (> (num-top-level-forms-in-deftest node) 1))
+ (hooks/reg-finding!
+ (assoc (meta node)
+ :message (str "This test looks like it contains several logically separate testing forms... break it"
+ " out into separate deftests to make it easier to test and debug")
+ :type :metabase/validate-deftest-logically-separate-tests)))))
+
(defn- ignore? [node error-type]
(contains? (hooks.common/ignored-linters node) error-type))
@@ -155,6 +185,7 @@
(= lang :clj))
(deftest-check-parallel node ns-sym (get-in config [:linters :metabase/validate-deftest])))
(deftest-check-not-horrifically-long node (get-in config [:linters :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests]))
+ (deftest-check-should-not-be-multiple-separate-tests node (get-in config [:linters :metabase/validate-deftest-logically-separate-tests]))
(deftest-check-no-driver-keywords node (get-in config [:linters :metabase/disallow-hardcoded-driver-names-in-tests]))
(deftest-check-in-valid-module input)
input)
diff --git a/bin/lint-migrations-file/test/lint_migrations_file_test.clj b/bin/lint-migrations-file/test/lint_migrations_file_test.clj
index dc10ba1a3ed..8a13f544499 100644
--- a/bin/lint-migrations-file/test/lint_migrations_file_test.clj
+++ b/bin/lint-migrations-file/test/lint_migrations_file_test.clj
@@ -72,7 +72,7 @@
(is (= ~info ex-data#)
"Error info does not match expected."))))
-(deftest require-unique-ids-test
+(deftest ^:parallel require-unique-ids-test
(testing "Make sure all migration IDs are unique"
(is-thrown-with-error-info?
"Change set IDs are not distinct."
@@ -81,7 +81,7 @@
(mock-change-set :id "v49.2024-01-01T10:30:00")
(mock-change-set :id "v49.2024-01-01T10:30:00")))))
-(deftest require-migrations-in-order-test
+(deftest ^:parallel require-migrations-in-order-test
(testing "Migrations must be in order"
(is-thrown-with-error-info?
"Change set IDs are not in order"
@@ -97,7 +97,7 @@
(mock-change-set :id "v49.2023-12-14T08:54:54")
(mock-change-set :id "v49.2023-12-14T08:54:53")))))
-(deftest only-one-column-per-add-column-test
+(deftest ^:parallel only-one-column-per-add-column-test
(testing "we should only allow one column per addColumn change"
(doseq [id [1 200]]
(is (= :ok
@@ -114,7 +114,7 @@
:changes [(mock-add-column-changes :columns [(mock-column :name "A")
(mock-column :name "B")])])))))))
-(deftest one-change-per-change-set-test
+(deftest ^:parallel one-change-per-change-set-test
(testing "only allow one change per change set"
(is (thrown-with-msg?
clojure.lang.ExceptionInfo
@@ -122,7 +122,7 @@
(validate
(mock-change-set :changes [(mock-add-column-changes) (mock-add-column-changes)]))))))
-(deftest require-comment-test
+(deftest ^:parallel require-comment-test
(testing "require a comment for a change set"
(is (thrown-with-msg?
clojure.lang.ExceptionInfo
@@ -131,7 +131,7 @@
(is (= :ok
(validate (mock-change-set :id "v49.2024-01-01T10:30:00", :comment "Added x.45.0"))))))
-(deftest no-on-delete-in-constraints-test
+(deftest ^:parallel no-on-delete-in-constraints-test
(testing "Make sure we don't use onDelete in constraints"
(doseq [id [1 200]
change-set [(mock-change-set
@@ -148,7 +148,7 @@
#"Invalid change set\."
(validate change-set)))))))
-(deftest require-remarks-for-create-table-test
+(deftest ^:parallel require-remarks-for-create-table-test
(testing "require remarks for newly created tables"
(is (thrown-with-msg?
clojure.lang.ExceptionInfo
@@ -158,7 +158,7 @@
:id "v45.00-001"
:changes [(update (mock-create-table-changes) :createTable dissoc :remarks)]))))))
-(deftest allow-multiple-sql-changes-if-dbmses-are-different
+(deftest ^:parallel allow-multiple-sql-changes-if-dbmses-are-different
(testing "Allow multiple SQL changes if DBMSes are different"
(is (= :ok
(validate
@@ -186,7 +186,7 @@
[{:sql {:dbms "h2", :sql "1"}}
{:sql {:dbms "postgresql,h2", :sql "2"}}]))))))
-(deftest validate-id-test
+(deftest ^:parallel validate-id-test
(letfn [(validate-id [id]
(validate (mock-change-set :id id)))]
(testing "Valid old-style ID"
@@ -210,7 +210,7 @@
"invalid minute" "v49.2024-01-01T10:60:00"
"invalid second" "v49.2024-01-01T10:30:60")))))
-(deftest ^:parallel validate-id-in-file-test
+(deftest ^:parallel ^:parallel validate-id-in-file-test
(letfn [(validate-id [id file]
(validate-file (io/file file) (mock-change-set :id id)))]
(testing "001_update_migrations.yaml"
@@ -244,7 +244,7 @@
#"Change set IDs are in the wrong file"
(validate-id "v57.2024-01-01T10:30:00" "056_update_migrations.yaml"))))))
-(deftest prevent-text-types-test
+(deftest ^:parallel prevent-text-types-test
(testing "should allow \"${text.type}\" columns from being added"
(is (= :ok
(validate
@@ -262,7 +262,7 @@
:id "v49.2024-01-01T10:30:00"
:changes [(mock-add-column-changes :columns [(mock-column :type problem-type)])])))))))
-(deftest prevent-bare-boolean-type-test
+(deftest ^:parallel prevent-bare-boolean-type-test
(testing "should allow adding \"${boolean.type}\" columns"
(is (= :ok
(validate
@@ -278,7 +278,7 @@
:id "v49.00-033"
:changes [(mock-add-column-changes :columns [(mock-column :type "boolean")])]))))))
-(deftest require-rollback-test
+(deftest ^:parallel require-rollback-test
(testing "change types with no automatic rollback support"
(testing "missing rollback key fails"
(is (thrown-with-msg?
@@ -297,7 +297,7 @@
(testing "change types with automatic rollback support are allowed"
(is (= :ok (validate (mock-change-set :id "v49.2024-01-01T10:30:00" :changes [(mock-add-column-changes)]))))))
-(deftest disallow-deletecascade-in-addcolumn-test
+(deftest ^:parallel disallow-deletecascade-in-addcolumn-test
(testing "addColumn with deleteCascade fails"
(is (thrown-with-msg?
clojure.lang.ExceptionInfo
@@ -306,7 +306,7 @@
:changes [(mock-add-column-changes
:columns [(mock-column :constraints {:deleteCascade true})])]))))))
-(deftest custom-changes-test
+(deftest ^:parallel custom-changes-test
(let [change-set (mock-change-set
:changes
[{:customChange {:class "metabase.app_db.custom_migrations.ReversibleUppercaseCards"}}])]
@@ -333,7 +333,7 @@
(is (= [:change.strict/customChange :custom-change/class]
(take-last 2 (:via specific))))))))
-(deftest forbidden-new-types-test
+(deftest ^:parallel forbidden-new-types-test
(testing "should throw if changes contains text type"
(is (is-thrown-with-error-info?
"Migration(s) ['v45.12-345'] uses invalid types (in 'blob','text')"
@@ -352,7 +352,9 @@
:columns [{:column {:name "foo"
:remarks "none"
:type "text"}}]}}]
- :rollback nil))))
+ :rollback nil)))))
+
+(deftest ^:parallel forbidden-new-types-test-2
(testing "should throw if changes contains boolean type"
(is-thrown-with-error-info?
"Migration(s) ['v49.00-033'] uses invalid types (in 'boolean')"
@@ -377,7 +379,9 @@
:remarks "meow"
:columns [{:column {:name "foo"
:remarks "none"
- :type "boolean"}}]}}])))))
+ :type "boolean"}}]}}]))))))
+
+(deftest ^:parallel forbidden-new-types-test-3
(testing "should throw if changes contains datetime type"
(is-thrown-with-error-info?
"Migration(s) ['v49.00-033'] uses invalid types (in 'timestamp','timestamp without time zone','datetime')"
diff --git a/enterprise/backend/test/metabase_enterprise/content_translation/routes_test.clj b/enterprise/backend/test/metabase_enterprise/content_translation/routes_test.clj
index a39eafef430..6b4a48018b5 100644
--- a/enterprise/backend/test/metabase_enterprise/content_translation/routes_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/content_translation/routes_test.clj
@@ -77,7 +77,9 @@
matches (filter #(and (= (nth % 0) "de")
(= (nth % 1) "Sample translation"))
data)]
- (is (seq matches)))))))
+ (is (seq matches))))))))
+
+(deftest content-translation-api-test-2
(testing "POST /api/ee/content-translation/upload-dictionary"
(testing "nonadmin cannot use"
(ct-utils/with-clean-translations!
diff --git a/enterprise/backend/test/metabase_enterprise/data_complexity_score/cli_test.clj b/enterprise/backend/test/metabase_enterprise/data_complexity_score/cli_test.clj
index c1c45be903e..f72c3f0473b 100644
--- a/enterprise/backend/test/metabase_enterprise/data_complexity_score/cli_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/data_complexity_score/cli_test.clj
@@ -77,11 +77,15 @@
:synonym-threshold 0.8
:weights complexity/weights
:metabot-source :universe-fallback}
- (:meta result))))))
+ (:meta result)))))))
+
+(deftest ^:parallel representation-fixture-scores-deterministically-test-2
(testing "the schema-less widgets table (under databases/<db>/tables/, no schema dir) loads into :universe"
(let [{:keys [universe]} (representation/load-dir representation-fixture-dir)]
(is (some #(= "widgets" (:name %)) universe)
- "schema-less Table directory should be picked up by the loader")))
+ "schema-less Table directory should be picked up by the loader"))))
+
+(deftest ^:parallel representation-fixture-scores-deterministically-test-3
(testing "audit-DB content (is_audit: true) is excluded from :universe — both Tables and Cards"
;; Mirrors the live appdb scorer's `[:not= audit/audit-db-id]` filter. The fixture has
;; `databases/audit_database/...` (`is_audit: true`) with a `query_log` Table and a
@@ -92,7 +96,9 @@
(is (not (contains? names "query_log"))
"Table in is_audit DB must not appear in :universe")
(is (not (contains? names "Audit Metric"))
- "Card whose database_id is the audit DB must not appear in :universe")))
+ "Card whose database_id is the audit DB must not appear in :universe"))))
+
+(deftest ^:parallel representation-fixture-scores-deterministically-test-4
(testing "FieldValues side-car YAMLs (`*___fieldvalues.yaml`) under fields/ do not inflate :field-count"
;; The fixture's `events/fields/event_id___fieldvalues.yaml` is a real-shape serdes side-car
;; sitting next to a Field YAML. `load-yamls-of-model` must skip it; otherwise the events Table
diff --git a/enterprise/backend/test/metabase_enterprise/data_complexity_score/complexity_test.clj b/enterprise/backend/test/metabase_enterprise/data_complexity_score/complexity_test.clj
index 3bcd2fa9ca5..359f8e56b72 100644
--- a/enterprise/backend/test/metabase_enterprise/data_complexity_score/complexity_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/data_complexity_score/complexity_test.clj
@@ -585,7 +585,9 @@
(is (some? (get result "products"))
"non-colliding entity is retained")
(is (empty? @unseen)
- "every expected fetch-batch pair-set must be requested"))))))
+ "every expected fetch-batch pair-set must be requested")))))))
+
+(deftest ^:sequential search-index-embedder-cross-batch-dedup-test-2
(testing "cross-batch, cross-model duplicates: model_id primary, model secondary"
;; Same normalized name from three different batches and three different model types.
;; model_id "5" appears twice (card + dataset); model_id "12" is in a third batch.
diff --git a/enterprise/backend/test/metabase_enterprise/remote_sync/source/ingestable_test.clj b/enterprise/backend/test/metabase_enterprise/remote_sync/source/ingestable_test.clj
index 20b49731955..136ea3e309b 100644
--- a/enterprise/backend/test/metabase_enterprise/remote_sync/source/ingestable_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/remote_sync/source/ingestable_test.clj
@@ -141,12 +141,16 @@
(testing "ingest-errors returns the parse failure"
(let [errors (serialization/ingest-errors ingestable)]
(is (= 1 (count errors)))
- (is (instance? Exception (first errors)))))))
+ (is (instance? Exception (first errors))))))))
+
+(deftest ingest-errors-test-2
(testing "ingest-errors returns [] when all files parse successfully"
(let [snapshot (source.p/snapshot (test-helpers/create-mock-source))
ingestable (ingestable/->IngestableSnapshot snapshot (atom nil) (atom []))]
(serialization/ingest-list ingestable)
- (is (= [] (serialization/ingest-errors ingestable)))))
+ (is (= [] (serialization/ingest-errors ingestable))))))
+
+(deftest ingest-errors-test-3
(testing "ingest-errors returns [] before cache is populated"
(let [bad-yaml "name: Bad Card\ndataset_query: [invalid\n"
files {"main" {"collections/coll01xxxxxxxxxxxxx_test/coll01xxxxxxxxxxxxx_test.yaml"
@@ -156,7 +160,9 @@
snapshot (source.p/snapshot (test-helpers/create-mock-source :initial-files files))
ingestable (ingestable/->IngestableSnapshot snapshot (atom nil) (atom []))]
(is (= [] (serialization/ingest-errors ingestable))
- "Before ingest-list is called, ingest-errors should return [] not the real errors")))
+ "Before ingest-list is called, ingest-errors should return [] not the real errors"))))
+
+(deftest ingest-errors-test-4
(testing "multiple bad files produce multiple errors"
(let [bad-yaml-1 "name: Bad1\ndataset_query: [invalid\n"
bad-yaml-2 "name: Bad2\ndataset_query: {broken\n"
@@ -170,7 +176,9 @@
ingestable (ingestable/->IngestableSnapshot snapshot (atom nil) (atom []))]
(serialization/ingest-list ingestable)
(is (= 2 (count (serialization/ingest-errors ingestable)))
- "Each unparseable file should produce a separate error")))
+ "Each unparseable file should produce a separate error"))))
+
+(deftest ingest-errors-test-5
(testing "wrapper ingestables delegate ingest-errors"
(let [bad-yaml "name: Bad\ndataset_query: [invalid\n"
files {"main" {"collections/coll01xxxxxxxxxxxxx_test/coll01xxxxxxxxxxxxx_test.yaml"
diff --git a/enterprise/backend/test/metabase_enterprise/replacement/runner_test.clj b/enterprise/backend/test/metabase_enterprise/replacement/runner_test.clj
index 23c87429e8f..ad851ffc412 100644
--- a/enterprise/backend/test/metabase_enterprise/replacement/runner_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/replacement/runner_test.clj
@@ -317,7 +317,9 @@
(is (= :type/Currency (:semantic_type fus-1)))
(is (some? fus-2))
(is (= "Order Date" (:display_name fus-2)))
- (is (= :type/CreationTimestamp (:semantic_type fus-2)))))))
+ (is (= :type/CreationTimestamp (:semantic_type fus-2))))))))
+
+(deftest copy-model-metadata-overrides!-test-2
(testing "matches joined columns using :lib/desired-column-alias instead of :name"
(mt/with-temp [:model/Table {table-id :id} {:name "transform_joined_output"
:db_id (mt/id)
diff --git a/test/metabase/agent_lib/representations/repair_test.clj b/test/metabase/agent_lib/representations/repair_test.clj
index 162d7b9f089..b04e9428fe0 100644
--- a/test/metabase/agent_lib/representations/repair_test.clj
+++ b/test/metabase/agent_lib/representations/repair_test.clj
@@ -100,14 +100,14 @@
;;; Pass 1 - insert `{}` options on clauses
;;; ============================================================
-(deftest insert-options-on-bare-clause-test
+(deftest ^:parallel insert-options-on-bare-clause-test
(testing "clause without options gets {} inserted"
(is (= ["count" {}]
(repair/repair trivial-mp ["count"])))
(is (= ["sum" {} ["field" {} ["Sample" "S" "T" "F"]]]
(repair/repair trivial-mp ["sum" ["field" ["Sample" "S" "T" "F"]]])))))
-(deftest do-not-corrupt-fk-paths-test
+(deftest ^:parallel do-not-corrupt-fk-paths-test
(testing "FK paths (all-string vectors) are left alone"
(let [fk ["Sample" "PUBLIC" "TBL" "COL"]]
(is (= fk (repair/repair trivial-mp fk))))
@@ -118,7 +118,7 @@
output (repair/repair trivial-mp input)]
(is (= ["field" {} ["Sample" "PUBLIC" "TBL" "COL"]] output)))))
-(deftest nested-clause-repair-test
+(deftest ^:parallel nested-clause-repair-test
(testing "options filled in at every nesting level"
(let [input ["and"
["="
@@ -133,7 +133,7 @@
[">" {} ["field" {} ["Sample" "S" "T" "B"]] 5]]
output)))))
-(deftest nil-options-replaced-test
+(deftest ^:parallel nil-options-replaced-test
(testing "nil in options slot is replaced with {}"
;; clj-yaml sometimes hands us nil for `~` where we'd want {}
(is (= ["count" {}] (repair/repair trivial-mp ["count" nil])))))
@@ -151,20 +151,24 @@
;;; `["field" {<merged opts>} [<FK>]]`.
;;; ============================================================
-(deftest unwrap-nested-field-test
+(deftest ^:parallel unwrap-nested-field-test
(testing "outer field wrapping an inner field with an FK is collapsed"
(let [input ["field" {"temporal-unit" "month"}
["field" {} ["Sample" "PUBLIC" "ACCOUNTS" "CANCELED_AT"]]]
output (repair/repair trivial-mp input)]
(is (= ["field" {"temporal-unit" "month"}
["Sample" "PUBLIC" "ACCOUNTS" "CANCELED_AT"]]
- output))))
+ output)))))
+
+(deftest ^:parallel unwrap-nested-field-test-2
(testing "outer options win on conflict (outer temporal-unit overrides inner)"
(let [input ["field" {"temporal-unit" "month"}
["field" {"temporal-unit" "day"} ["Sample" "PUBLIC" "T" "COL"]]]
output (repair/repair trivial-mp input)]
(is (= ["field" {"temporal-unit" "month"} ["Sample" "PUBLIC" "T" "COL"]]
- output))))
+ output)))))
+
+(deftest ^:parallel unwrap-nested-field-test-3
(testing "inner-only options are preserved when outer doesn't set them"
(let [input ["field" {"temporal-unit" "month"}
["field" {"source-field" ["Sample" "PUBLIC" "T" "FK"]}
@@ -173,13 +177,17 @@
(is (= ["field" {"temporal-unit" "month"
"source-field" ["Sample" "PUBLIC" "T" "FK"]}
["Sample" "PUBLIC" "T" "COL"]]
- output))))
+ output)))))
+
+(deftest ^:parallel unwrap-nested-field-test-4
(testing "outer empty opts + nested field: outer gets inner's opts"
(let [input ["field" {}
["field" {"temporal-unit" "day"} ["Sample" "PUBLIC" "T" "COL"]]]
output (repair/repair trivial-mp input)]
(is (= ["field" {"temporal-unit" "day"} ["Sample" "PUBLIC" "T" "COL"]]
- output))))
+ output)))))
+
+(deftest ^:parallel unwrap-nested-field-test-5
(testing "nested inside a larger clause (e.g. breakout of a stage) is collapsed"
(let [input ["and" {}
["=" {}
@@ -191,7 +199,9 @@
["=" {}
["field" {"temporal-unit" "month"} ["Sample" "PUBLIC" "T" "COL"]]
"Bikes"]]
- output))))
+ output)))))
+
+(deftest ^:parallel unwrap-nested-field-test-6
(testing "triple-nested field collapses to one"
(let [input ["field" {"temporal-unit" "month"}
["field" {}
@@ -201,10 +211,14 @@
(is (= ["field" {"temporal-unit" "month"
"source-field" ["Sample" "PUBLIC" "T" "FK"]}
["Sample" "PUBLIC" "T" "COL"]]
- output))))
+ output)))))
+
+(deftest ^:parallel unwrap-nested-field-test-7
(testing "non-nested `field` clauses are left alone"
(let [input ["field" {"temporal-unit" "month"} ["Sample" "PUBLIC" "T" "COL"]]]
- (is (= input (repair/repair trivial-mp input)))))
+ (is (= input (repair/repair trivial-mp input))))))
+
+(deftest ^:parallel unwrap-nested-field-test-8
(testing "cross-stage string-column field inside outer field is preserved"
;; [field {temporal-unit ...} [field {} "some-col-name"]] is the same bug pattern but
;; with a cross-stage (string) target. Still unwrap.
@@ -218,7 +232,7 @@
;;; Pass 1.81 - rewrite operator-name aliases to canonical lib heads
;;; ============================================================
-(deftest rewrite-shell-style-comparison-aliases-test
+(deftest ^:parallel rewrite-shell-style-comparison-aliases-test
(testing "shell-style comparison operators rewrite to canonical"
(let [field ["field" {} ["Sample" "PUBLIC" "X" "A"]]]
(doseq [[alias canonical] [["eq" "="]
@@ -233,7 +247,7 @@
(repair/repair trivial-mp [alias {} field 10]))
(str alias " -> " canonical))))))
-(deftest rewrite-verbose-comparison-aliases-test
+(deftest ^:parallel rewrite-verbose-comparison-aliases-test
(testing "verbose comparison spellings"
(let [field ["field" {} ["Sample" "PUBLIC" "X" "A"]]]
(is (= ["=" {} field 10]
@@ -241,7 +255,7 @@
(is (= ["!=" {} field 10]
(repair/repair trivial-mp ["not-equals" {} field 10]))))))
-(deftest rewrite-aggregation-aliases-test
+(deftest ^:parallel rewrite-aggregation-aliases-test
(testing "aggregation lib-renames"
(let [field ["field" {} ["Sample" "PUBLIC" "X" "A"]]
pred ["=" {} field 1]]
@@ -256,7 +270,7 @@
(is (= ["distinct" {} field]
(repair/repair trivial-mp ["distinct-count" {} field]))))))
-(deftest rewrite-temporal-and-null-aliases-test
+(deftest ^:parallel rewrite-temporal-and-null-aliases-test
(testing "temporal & null lib-renames"
(let [field ["field" {} ["Sample" "PUBLIC" "X" "DATE"]]]
(is (= ["relative-datetime" {} -7 "day"]
@@ -266,7 +280,7 @@
(is (= ["not-null" {} field]
(repair/repair trivial-mp ["is-not-null" {} field]))))))
-(deftest operator-alias-case-insensitive-test
+(deftest ^:parallel operator-alias-case-insensitive-test
(testing "alias matching is case-insensitive"
(let [field ["field" {} ["Sample" "PUBLIC" "X" "A"]]]
(doseq [variant ["EQ" "Eq" "EQUALS" "Equals"]]
@@ -274,14 +288,14 @@
(repair/repair trivial-mp [variant {} field 10]))
variant)))))
-(deftest operator-alias-canonical-untouched-test
+(deftest ^:parallel operator-alias-canonical-untouched-test
(testing "already-canonical heads are not double-rewritten (cheap idempotency)"
(let [field ["field" {} ["Sample" "PUBLIC" "X" "A"]]]
(doseq [canonical ["=" "!=" "<" "<=" ">" ">="]]
(let [input [canonical {} field 10]]
(is (= input (repair/repair trivial-mp input)) canonical))))))
-(deftest operator-alias-nested-test
+(deftest ^:parallel operator-alias-nested-test
(testing "alias nested deep inside a tree gets rewritten"
(let [field ["field" {} ["Sample" "PUBLIC" "X" "A"]]
input ["and" {}
@@ -292,7 +306,7 @@
[">" {} field 5]]
(repair/repair trivial-mp input))))))
-(deftest operator-alias-fk-path-untouched-test
+(deftest ^:parallel operator-alias-fk-path-untouched-test
(testing "a column literally named 'eq' or 'gt' inside an FK path is NOT rewritten"
(is (= ["field" {} ["Sample" "PUBLIC" "T" "eq"]]
(repair/repair trivial-mp ["field" {} ["Sample" "PUBLIC" "T" "eq"]])))
@@ -303,7 +317,7 @@
;;; Pass 1.8 - rewrite temporal-bucket-extraction aliases to canonical names
;;; ============================================================
-(deftest rewrite-temporal-bucket-aliases-test
+(deftest ^:parallel rewrite-temporal-bucket-aliases-test
(testing "each alias rewrites to its canonical lib head"
(doseq [[alias canonical] [["dayofweek" "get-day-of-week"]
["day-of-week" "get-day-of-week"]
@@ -339,7 +353,7 @@
;;; Pass 1.85 - rewrite order-by direction aliases to canonical asc/desc
;;; ============================================================
-(deftest rewrite-direction-aliases-test
+(deftest ^:parallel rewrite-direction-aliases-test
(testing "long-form aliases rewrite to canonical short form"
(is (= ["asc" {} ["field" {} ["Sample" "PUBLIC" "T" "COL"]]]
(repair/repair trivial-mp
@@ -384,21 +398,21 @@
;;; Pass 1.84 - normalise alternative case / if argument shapes
;;; ============================================================
-(deftest case-three-bare-args-test
+(deftest ^:parallel case-three-bare-args-test
(testing "[case {} pred then else] -> canonical pairs + default"
(let [pred ["=" {} ["field" {} ["Sample" "PUBLIC" "X" "A"]] 1]
input ["case" {} pred 100 0]]
(is (= ["case" {} [[pred 100]] 0]
(repair/repair trivial-mp input))))))
-(deftest case-two-bare-args-test
+(deftest ^:parallel case-two-bare-args-test
(testing "[case {} pred then] (no default) -> canonical pairs only"
(let [pred ["=" {} ["field" {} ["Sample" "PUBLIC" "X" "A"]] 1]
input ["case" {} pred 100]]
(is (= ["case" {} [[pred 100]]]
(repair/repair trivial-mp input))))))
-(deftest case-branch-pairs-as-separate-args-test
+(deftest ^:parallel case-branch-pairs-as-separate-args-test
(testing "branch pairs as separate args + trailing default"
(let [p1 ["=" {} ["field" {} ["Sample" "PUBLIC" "X" "A"]] 1]
p2 ["=" {} ["field" {} ["Sample" "PUBLIC" "X" "A"]] 2]
@@ -412,7 +426,7 @@
(is (= ["case" {} [[p1 100] [p2 200]]]
(repair/repair trivial-mp input))))))
-(deftest case-flat-alternating-args-test
+(deftest ^:parallel case-flat-alternating-args-test
(testing "flat even-arity alternating: [case {} p1 t1 p2 t2]"
(let [p1 ["=" {} ["field" {} ["Sample" "PUBLIC" "X" "A"]] 1]
p2 ["=" {} ["field" {} ["Sample" "PUBLIC" "X" "A"]] 2]
@@ -426,7 +440,7 @@
(is (= ["case" {} [[p1 100] [p2 200]] 0]
(repair/repair trivial-mp input))))))
-(deftest case-trailing-else-branch-test
+(deftest ^:parallel case-trailing-else-branch-test
(testing "trailing [\"else\" x] inside the pairs vector is stripped, x becomes default"
(let [p1 ["=" {} ["field" {} ["Sample" "PUBLIC" "X" "A"]] 1]
input ["case" {} [[p1 100] ["else" 0]]]]
@@ -440,7 +454,7 @@
(is (= ["case" {} [[p1 100]] 0]
(repair/repair trivial-mp input))))))
-(deftest case-already-canonical-test
+(deftest ^:parallel case-already-canonical-test
(testing "canonical [case {} [[p t]]] is unchanged"
(let [p1 ["=" {} ["field" {} ["Sample" "PUBLIC" "X" "A"]] 1]
input ["case" {} [[p1 100]]]]
@@ -450,14 +464,14 @@
input ["case" {} [[p1 100]] 0]]
(is (= input (repair/repair trivial-mp input))))))
-(deftest case-if-alias-test
+(deftest ^:parallel case-if-alias-test
(testing "`if` alias is normalised the same way as case"
(let [pred ["=" {} ["field" {} ["Sample" "PUBLIC" "X" "A"]] 1]
input ["if" {} pred 100 0]]
(is (= ["if" {} [[pred 100]] 0]
(repair/repair trivial-mp input))))))
-(deftest case-idempotent-test
+(deftest ^:parallel case-idempotent-test
(testing "normalisation is idempotent"
(let [pred ["=" {} ["field" {} ["Sample" "PUBLIC" "X" "A"]] 1]]
(doseq [input [["case" {} pred 100 0]
@@ -473,7 +487,7 @@
;;; Pass 1.82 - normalise list-valued comparison/in clauses to flat positional args
;;; ============================================================
-(deftest splat-in-values-list-test
+(deftest ^:parallel splat-in-values-list-test
(testing "[in {} lhs [v1 v2 v3]] splats values into positional args"
(let [field ["field" {} ["Sample" "PUBLIC" "USERS" "NAME"]]
input ["in" {} field ["alice" "bob" "carol"]]]
@@ -489,7 +503,7 @@
input ["in" {} field "alice" "bob" "carol"]]
(is (= input (repair/repair trivial-mp input))))))
-(deftest convert-eq-with-list-to-in-test
+(deftest ^:parallel convert-eq-with-list-to-in-test
(testing "[= {} lhs [v1 v2 v3]] becomes [in {} lhs v1 v2 v3]"
(let [field ["field" {} ["Sample" "PUBLIC" "USERS" "NAME"]]
input ["=" {} field ["alice" "bob"]]]
@@ -505,7 +519,7 @@
input ["=" {} field "alice"]]
(is (= input (repair/repair trivial-mp input))))))
-(deftest in-with-clause-rhs-untouched-test
+(deftest ^:parallel in-with-clause-rhs-untouched-test
(testing "a clause-shaped rhs (e.g. nested expression) is not splatted"
(let [field ["field" {} ["Sample" "PUBLIC" "USERS" "CREATED_AT"]]
abs ["absolute-datetime" {} "2024-01-01" "day"]
@@ -520,7 +534,7 @@
;; Untouched because abs is a clause, not a scalar.
(is (= input (repair/repair trivial-mp input))))))
-(deftest splat-mixed-scalars-test
+(deftest ^:parallel splat-mixed-scalars-test
(testing "a values list with mixed scalar types splats correctly"
(let [field ["field" {} ["Sample" "PUBLIC" "USERS" "AGE"]]
input ["in" {} field [18 21 65]]]
@@ -531,7 +545,7 @@
(is (= ["in" {} field true false]
(repair/repair trivial-mp input))))))
-(deftest splat-idempotent-test
+(deftest ^:parallel splat-idempotent-test
(testing "splat is idempotent"
(let [field ["field" {} ["Sample" "PUBLIC" "USERS" "NAME"]]]
(doseq [input [["in" {} field ["alice" "bob"]]
@@ -546,7 +560,7 @@
;;; Pass 1.83 - unwrap boolean wrapper clauses
;;; ============================================================
-(deftest unwrap-boolean-wrapper-true-test
+(deftest ^:parallel unwrap-boolean-wrapper-true-test
(testing "[true {} x] unwraps to x"
(let [field ["field" {} ["Sample" "PUBLIC" "USERS" "NAME"]]
inner ["=" {} field "alice"]
@@ -559,7 +573,7 @@
input ["true" ["=" field "alice"]]]
(is (= ["=" {} field "alice"] (repair/repair trivial-mp input))))))
-(deftest unwrap-boolean-wrapper-false-test
+(deftest ^:parallel unwrap-boolean-wrapper-false-test
(testing "[false {} x] rewrites to [not {} x]"
(let [field ["field" {} ["Sample" "PUBLIC" "USERS" "NAME"]]
inner ["=" {} field "alice"]
@@ -567,13 +581,13 @@
(is (= ["not" {} inner]
(repair/repair trivial-mp input))))))
-(deftest boolean-literal-clauses-untouched-test
+(deftest ^:parallel boolean-literal-clauses-untouched-test
(testing "[true {}] (0-arg boolean literal) is left alone"
(is (= ["true" {}] (repair/repair trivial-mp ["true" {}]))))
(testing "[false {}] (0-arg boolean literal) is left alone"
(is (= ["false" {}] (repair/repair trivial-mp ["false" {}])))))
-(deftest boolean-wrapper-mixed-case-test
+(deftest ^:parallel boolean-wrapper-mixed-case-test
(testing "case-insensitive head matching"
(let [field ["field" {} ["Sample" "PUBLIC" "USERS" "NAME"]]
inner ["=" {} field "alice"]]
@@ -584,7 +598,7 @@
(is (= ["not" {} inner] (repair/repair trivial-mp [variant {} inner]))
variant)))))
-(deftest boolean-wrapper-nested-test
+(deftest ^:parallel boolean-wrapper-nested-test
(testing "nested wrapper clauses unwrap from the inside out"
(let [field ["field" {} ["Sample" "PUBLIC" "USERS" "NAME"]]
inner ["=" {} field "alice"]
@@ -600,7 +614,7 @@
;;; Pass 1.86 - wrap bare ISO-date strings as absolute-datetime in between
;;; ============================================================
-(deftest wrap-iso-date-bounds-both-bare-test
+(deftest ^:parallel wrap-iso-date-bounds-both-bare-test
(testing "both bounds are bare yyyy-mm-dd strings: both get wrapped"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "CREATED_AT"]]
input ["between" {} field "2024-01-01" "2024-12-31"]]
@@ -610,7 +624,7 @@
["absolute-datetime" {} "2024-12-31" "day"]]
(repair/repair trivial-mp input))))))
-(deftest wrap-iso-date-bounds-mixed-test
+(deftest ^:parallel wrap-iso-date-bounds-mixed-test
(testing "one bound already absolute-datetime, the other a bare string: bare side
gets wrapped"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "CREATED_AT"]]
@@ -630,13 +644,13 @@
["absolute-datetime" {} "2024-12-31" "day"]]
(repair/repair trivial-mp input))))))
-(deftest wrap-iso-date-bounds-numeric-untouched-test
+(deftest ^:parallel wrap-iso-date-bounds-numeric-untouched-test
(testing "both bounds numeric: not wrapped (between also works for numbers)"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "TOTAL"]]
input ["between" {} field 10 100]]
(is (= input (repair/repair trivial-mp input))))))
-(deftest wrap-iso-date-bounds-with-time-portion-test
+(deftest ^:parallel wrap-iso-date-bounds-with-time-portion-test
(testing "yyyy-mm-ddThh:mm:ss bounds also get wrapped"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "CREATED_AT"]]
input ["between" {} field "2024-06-15T09:00:00" "2024-06-15T18:00:00"]]
@@ -646,7 +660,7 @@
["absolute-datetime" {} "2024-06-15T18:00:00" "day"]]
(repair/repair trivial-mp input))))))
-(deftest wrap-iso-date-bounds-idempotent-test
+(deftest ^:parallel wrap-iso-date-bounds-idempotent-test
(testing "wrapping is idempotent: two wraps == one wrap"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "CREATED_AT"]]
input ["between" {} field "2024-01-01" "2024-12-31"]
@@ -654,7 +668,7 @@
twice (repair/repair trivial-mp once)]
(is (= once twice)))))
-(deftest wrap-iso-date-bounds-then-swap-test
+(deftest ^:parallel wrap-iso-date-bounds-then-swap-test
(testing "wrap + swap compose: out-of-order bare ISO strings wrap then swap"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "CREATED_AT"]]
input ["between" {} field "2024-12-31" "2024-01-01"]]
@@ -664,7 +678,7 @@
["absolute-datetime" {} "2024-12-31" "day"]]
(repair/repair trivial-mp input))))))
-(deftest wrap-iso-date-bounds-non-iso-untouched-test
+(deftest ^:parallel wrap-iso-date-bounds-non-iso-untouched-test
(testing "random strings (not yyyy-mm-dd shaped) are left alone"
(let [field ["field" {} ["Sample" "PUBLIC" "X"]]
input ["between" {} field "hello" "world"]]
@@ -674,7 +688,7 @@
;;; Pass 1.865 - wrap bare "now" literals in temporal-comparison contexts
;;; ============================================================
-(deftest wrap-now-literals-comparison-test
+(deftest ^:parallel wrap-now-literals-comparison-test
(testing "`<` between a temporal-bucketed field and bare 'now': now gets wrapped"
(let [field-with-unit ["field" {"temporal-unit" "day"}
["Sample" "PUBLIC" "ORDERS" "CREATED_AT"]]
@@ -701,7 +715,7 @@
input ["<" {} abs ["now" {}]]]
(is (= input (repair/repair trivial-mp input))))))
-(deftest wrap-now-literals-between-test
+(deftest ^:parallel wrap-now-literals-between-test
(testing "between(<temporal-field>, ISO-string, 'now') wraps both bounds"
(let [field-with-unit ["field" {"temporal-unit" "day"}
["Sample" "PUBLIC" "ORDERS" "CREATED_AT"]]
@@ -723,7 +737,7 @@
;;; Pass 1.87 - swap out-of-order between bounds (literal scalars only)
;;; ============================================================
-(deftest swap-between-bounds-numeric-test
+(deftest ^:parallel swap-between-bounds-numeric-test
(testing "numeric lower > upper is swapped"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "TOTAL"]]
input ["between" {} field 100 10]]
@@ -744,7 +758,7 @@
twice (repair/repair trivial-mp once)]
(is (= once twice)))))
-(deftest swap-between-bounds-iso-string-test
+(deftest ^:parallel swap-between-bounds-iso-string-test
;; Note: bare ISO strings are wrapped by Pass 1.86 ("wrap-iso-date-bounds*") *before*
;; this swap pass runs, so the canonical post-repair form has \"[absolute-datetime ...]\"
;; bounds. The swap still proceeds because \"swap-between-bounds*\" knows how to extract
@@ -774,7 +788,7 @@
["absolute-datetime" {} "2024-12-31" "day"]]
(repair/repair trivial-mp input))))))
-(deftest swap-between-bounds-absolute-datetime-test
+(deftest ^:parallel swap-between-bounds-absolute-datetime-test
(testing "out-of-order absolute-datetime clauses: swap by inner ISO string"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "CREATED_AT"]]
hi ["absolute-datetime" {} "2024-12-31" "day"]
@@ -789,7 +803,7 @@
input ["between" {} field lo hi]]
(is (= input (repair/repair trivial-mp input))))))
-(deftest swap-between-bounds-non-literal-untouched-test
+(deftest ^:parallel swap-between-bounds-non-literal-untouched-test
(testing "non-literal bound (a relative-datetime clause) is left alone - we can't
compare without execution"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "CREATED_AT"]]
@@ -803,7 +817,7 @@
input ["between" {} field other 100]]
(is (= input (repair/repair trivial-mp input))))))
-(deftest swap-between-bounds-mixed-types-untouched-test
+(deftest ^:parallel swap-between-bounds-mixed-types-untouched-test
(testing "mixed-kind bounds (number vs string) are left alone"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "X"]]
input ["between" {} field 10 "hello"]]
@@ -813,7 +827,7 @@
;;; Pass 1.55 - normalise `fields:` to sequential-of-clause when given a single clause
;;; ============================================================
-(deftest normalise-fields-on-stage-test
+(deftest ^:parallel normalise-fields-on-stage-test
(testing "single clause as `fields:` value gets wrapped in a one-element list"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "ID"]]
input {"lib/type" "mbql/query"
@@ -833,7 +847,7 @@
output (repair/repair trivial-mp input)]
(is (= [field] (get-in output ["stages" 0 "fields"]))))))
-(deftest normalise-fields-on-join-test
+(deftest ^:parallel normalise-fields-on-join-test
(testing "single clause as join `fields:` gets wrapped"
(let [field ["field" {} ["Sample" "PUBLIC" "PRODUCTS" "NAME"]]
stage {"lib/type" "mbql.stage/mbql"
@@ -872,7 +886,7 @@
(is (= enum-value (get-in output ["stages" 0 "joins" 0 "fields"]))
enum-value)))))
-(deftest normalise-fields-idempotent-test
+(deftest ^:parallel normalise-fields-idempotent-test
(testing "after wrap, second pass is a no-op"
(let [field ["field" {} ["Sample" "PUBLIC" "ORDERS" "ID"]]
input {"lib/type" "mbql/query"
@@ -888,7 +902,7 @@
;;; Pass 2 - fill in missing `lib/type`
;;; ============================================================
-(deftest add-query-lib-type-test
+(deftest ^:parallel add-query-lib-type-test
(testing "top-level query without lib/type gets mbql/query"
(let [input {"database" "Sample"
"stages" [{"lib/type" "mbql.stage/mbql"
@@ -902,7 +916,7 @@
"source-table" ["Sample" "PUBLIC" "ORDERS"]}]}]
(is (= input (repair/repair trivial-mp input))))))
-(deftest add-stage-lib-type-test
+(deftest ^:parallel add-stage-lib-type-test
(testing "stage without lib/type gets mbql.stage/mbql"
(let [input {"lib/type" "mbql/query"
"database" "Sample"
@@ -930,7 +944,7 @@
;;; before this repair pass even runs.
;;; ============================================================
-(deftest stamp-top-level-database-from-source-table-test
+(deftest ^:parallel stamp-top-level-database-from-source-table-test
(testing "Pass 1.9 stamps `database:` onto a query that doesn't have one, using the MP name."
(let [input {"lib/type" "mbql/query"
"stages" [{"lib/type" "mbql.stage/mbql"
@@ -939,7 +953,7 @@
output (repair/repair mp-fks input)]
(is (= "Sample" (get output "database"))))))
-(deftest stamp-top-level-database-overwrites-mismatch-test
+(deftest ^:parallel stamp-top-level-database-overwrites-mismatch-test
(testing "Pass 1.9 silently overwrites a stale / wrong `database:` with the MP's canonical name."
(let [input {"lib/type" "mbql/query"
"database" "DatabaseFormerlyKnownAsSample"
@@ -949,7 +963,7 @@
output (repair/repair mp-fks input)]
(is (= "Sample" (get output "database"))))))
-(deftest stamp-top-level-database-idempotent-test
+(deftest ^:parallel stamp-top-level-database-idempotent-test
(testing "Pass 1.9 is a fixed point: running it twice gives the same output."
(let [input {"lib/type" "mbql/query"
"stages" [{"lib/type" "mbql.stage/mbql"
@@ -959,7 +973,7 @@
twice (repair/repair mp-fks once)]
(is (= once twice)))))
-(deftest stamp-top-level-database-no-mp-fallback-test
+(deftest ^:parallel stamp-top-level-database-no-mp-fallback-test
(testing "With no MP we still use the raw `source-table[0]` string as a fallback (unit-test isolation path)."
(let [input {"lib/type" "mbql/query"
"stages" [{"lib/type" "mbql.stage/mbql"
@@ -985,7 +999,7 @@
(defn- agg-uuid-of [stage idx]
(get-in stage ["aggregation" idx 1 "lib/uuid"]))
-(deftest rewrite-order-by-inline-agg-happy-path-test
+(deftest ^:parallel rewrite-order-by-inline-agg-happy-path-test
(testing "inline aggregation in order-by gets rewritten to an aggregation ref"
(let [input {"lib/type" "mbql/query"
"database" "Sample"
@@ -1007,7 +1021,7 @@
(is (= ["aggregation" {} agg-uuid]
(get-in stage ["order-by" 0 2])))))))
-(deftest rewrite-order-by-multiple-aggregations-test
+(deftest ^:parallel rewrite-order-by-multiple-aggregations-test
(testing "order-by entries match the right aggregation by structural equality"
(let [input {"lib/type" "mbql/query"
"database" "Sample"
@@ -1034,7 +1048,7 @@
(is (= ["aggregation" {} sum-uuid] (get-in stage ["order-by" 1 2]))
"second order-by (sum TOTAL) refers to the sum aggregation"))))
-(deftest rewrite-order-by-reuses-existing-uuid-test
+(deftest ^:parallel rewrite-order-by-reuses-existing-uuid-test
(testing "if the matching aggregation already has a lib/uuid, reuse it"
(let [existing-uuid "11111111-2222-3333-4444-555555555555"
input {"lib/type" "mbql/query"
@@ -1054,7 +1068,7 @@
"the pre-existing uuid is preserved")
(is (= ["aggregation" {} existing-uuid] (get-in stage ["order-by" 0 2]))))))
-(deftest rewrite-order-by-leaves-existing-aggregation-ref-alone-test
+(deftest ^:parallel rewrite-order-by-leaves-existing-aggregation-ref-alone-test
(testing "an order-by that already uses [\"aggregation\" {} <uuid>] is left alone"
(let [agg-uuid "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
input {"lib/type" "mbql/query"
@@ -1068,7 +1082,7 @@
["aggregation" {} agg-uuid]]]}]}]
(is (= input (repair/repair trivial-mp input))))))
-(deftest rewrite-order-by-leaves-non-aggregation-orderings-alone-test
+(deftest ^:parallel rewrite-order-by-leaves-non-aggregation-orderings-alone-test
(testing "order-by on a plain field is left alone"
(let [input {"lib/type" "mbql/query"
"database" "Sample"
@@ -1080,7 +1094,7 @@
["Sample" "PUBLIC" "ORDERS" "ID"]]]]}]}]
(is (= input (repair/repair trivial-mp input))))))
-(deftest rewrite-order-by-leaves-non-matching-aggregation-alone-test
+(deftest ^:parallel rewrite-order-by-leaves-non-matching-aggregation-alone-test
(testing (str "if the inline order-by aggregation does NOT match any aggregation in the\n"
"stage, leave it alone (let validation/normalize surface the real error)")
(let [input {"lib/type" "mbql/query"
@@ -1096,7 +1110,7 @@
(is (= ["sum" {} ["field" {} ["Sample" "PUBLIC" "ORDERS" "TOTAL"]]]
(get-in repaired ["stages" 0 "order-by" 0 2]))))))
-(deftest rewrite-order-by-idempotent-test
+(deftest ^:parallel rewrite-order-by-idempotent-test
(testing "running repair twice produces the same result (UUID is stable across runs)"
(let [input {"lib/type" "mbql/query"
"database" "Sample"
@@ -1117,7 +1131,7 @@
;;; End-to-end repair against an LLM shortcut shape
;;; ============================================================
-(deftest end-to-end-shortcut-repair-test
+(deftest ^:parallel end-to-end-shortcut-repair-test
(testing "LLM-style shortcut missing both lib/types and options maps still validates after repair"
;; The `:lib.schema/external-query` validation at the API boundary rejects this shape, but
;; the repair pipeline itself is still expected to handle it for callers that bypass
@@ -1136,7 +1150,7 @@
;;; Idempotency - unit + property based
;;; ============================================================
-(deftest idempotency-happy-path-test
+(deftest ^:parallel idempotency-happy-path-test
(testing "a fully-valid query is a fixed point"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -1148,7 +1162,7 @@
(is (= q (repair/repair trivial-mp q)))
(is (= (repair/repair trivial-mp q) (repair/repair trivial-mp (repair/repair trivial-mp q)))))))
-(deftest idempotency-degenerate-test
+(deftest ^:parallel idempotency-degenerate-test
(testing "repair(repair(x)) == repair(x) for a broken LLM input"
(let [broken {"database" "Sample"
"stages" [{"source-table" ["Sample" "PUBLIC" "ORDERS"]
@@ -1389,14 +1403,14 @@
"breakout" [["field" {}
["Sample" "PUBLIC" "PRODUCTS" "CATEGORY"]]]}]})
-(deftest implicit-join-happy-path-test
+(deftest ^:parallel implicit-join-happy-path-test
(testing "cross-table field gets `source-field` auto-filled to the unique FK path"
(let [out (repair/repair mp-fks base-query)
field-opts (get-in out ["stages" 0 "breakout" 0 1])]
(is (= ["Sample" "PUBLIC" "ORDERS" "PRODUCT_ID"]
(get field-opts "source-field"))))))
-(deftest implicit-join-preserves-existing-source-field-test
+(deftest ^:parallel implicit-join-preserves-existing-source-field-test
(testing "if the clause already has source-field, leave it alone"
(let [q (assoc-in base-query
["stages" 0 "breakout" 0 1]
@@ -1405,7 +1419,7 @@
(is (= {"source-field" ["Sample" "PUBLIC" "ORDERS" "PRODUCT_ID"]}
(get-in out ["stages" 0 "breakout" 0 1]))))))
-(deftest implicit-join-skips-join-alias-test
+(deftest ^:parallel implicit-join-skips-join-alias-test
(testing "field with join-alias is treated as an explicit-join reference and untouched"
(let [q (assoc-in base-query
["stages" 0 "breakout" 0 1]
@@ -1414,7 +1428,7 @@
(is (= {"join-alias" "Products"}
(get-in out ["stages" 0 "breakout" 0 1]))))))
-(deftest implicit-join-skips-source-field-name-test
+(deftest ^:parallel implicit-join-skips-source-field-name-test
(testing (str "a field clause carrying `source-field-name` (multi-stage implicit-join via a "
"previous-stage column name) is left alone - we don't auto-fill `source-field`, "
"even though the target table is otherwise reachable via a unique FK")
@@ -1425,7 +1439,7 @@
(is (= opts out-opts))
(is (not (contains? out-opts "source-field"))))))
-(deftest implicit-join-skips-source-field-join-alias-test
+(deftest ^:parallel implicit-join-skips-source-field-join-alias-test
(testing (str "a field clause carrying `source-field-join-alias` (implicit-join where the FK "
"column lives on an explicitly-joined table) is left alone")
(let [opts {"source-field-join-alias" "Orders_A"}
@@ -1435,7 +1449,7 @@
(is (= opts out-opts))
(is (not (contains? out-opts "source-field"))))))
-(deftest implicit-join-skips-field-on-source-table-test
+(deftest ^:parallel implicit-join-skips-field-on-source-table-test
(testing "field that already lives on source-table doesn't get source-field added"
(let [q (assoc-in base-query
["stages" 0 "breakout"]
@@ -1443,7 +1457,7 @@
out (repair/repair mp-fks q)]
(is (= {} (get-in out ["stages" 0 "breakout" 0 1]))))))
-(deftest implicit-join-no-fk-path-test
+(deftest ^:parallel implicit-join-no-fk-path-test
(testing "throws :no-fk-path when the target table isn't reachable via any FK"
(try
(repair/repair mp-no-fk base-query)
@@ -1454,7 +1468,7 @@
(is (true? (:agent-error? d)))
(is (re-find #"no foreign key" (ex-message e))))))))
-(deftest implicit-join-ambiguous-fk-test
+(deftest ^:parallel implicit-join-ambiguous-fk-test
(testing (str "throws :ambiguous-fk when multiple FKs exist, and does NOT enumerate the "
"candidate FK column names (parity with the S1 info-leak strip: the "
"un-sandboxed metadata provider could otherwise surface bridge-table "
@@ -1475,7 +1489,7 @@
(testing "message tells the LLM how to disambiguate via `source-field`"
(is (re-find #"source-field" msg))))))))
-(deftest implicit-join-skips-joins-subtree-test
+(deftest ^:parallel implicit-join-skips-joins-subtree-test
(testing "field references inside explicit joins are not auto-wired with source-field"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -1500,13 +1514,13 @@
(testing "breakout field with join-alias is preserved as-is"
(is (= {"join-alias" "P"} breakout-opts))))))
-(deftest implicit-join-idempotent-test
+(deftest ^:parallel implicit-join-idempotent-test
(testing "implicit-join repair is idempotent"
(let [once (repair/repair mp-fks base-query)
twice (repair/repair mp-fks once)]
(is (= once twice)))))
-(deftest implicit-join-no-op-when-mp-cannot-resolve-source-table-test
+(deftest ^:parallel implicit-join-no-op-when-mp-cannot-resolve-source-table-test
(testing "when the MP can't resolve the source-table, the pass is a no-op (let later stages report)"
;; trivial-mp has only a Database, no tables. Source-table resolution fails silently.
(let [out (repair/repair trivial-mp base-query)]
@@ -1536,7 +1550,7 @@
"breakout" [["field" {}
["Sample" "PUBLIC" "CATEGORIES" "NAME"]]]}]})
-(deftest source-field-join-alias-happy-path-test
+(deftest ^:parallel source-field-join-alias-happy-path-test
(testing (str "a field whose target is reachable through exactly one explicit join via a "
"single FK gets both `source-field-join-alias` and the matching portable "
"`source-field` filled in")
@@ -1546,13 +1560,13 @@
(is (= ["Sample" "PUBLIC" "PRODUCTS" "CATEGORY_ID"]
(get field-opts "source-field"))))))
-(deftest source-field-join-alias-idempotent-test
+(deftest ^:parallel source-field-join-alias-idempotent-test
(testing "running repair twice produces the same query (Pass 3.5 is idempotent)"
(let [once (repair/repair mp-via-join join-base-query)
twice (repair/repair mp-via-join once)]
(is (= once twice)))))
-(deftest source-field-join-alias-preserves-existing-disambiguators-test
+(deftest ^:parallel source-field-join-alias-preserves-existing-disambiguators-test
(testing "if the clause already carries `source-field-join-alias`, leave it alone"
(let [q (assoc-in join-base-query ["stages" 0 "breakout" 0 1]
{"source-field-join-alias" "P"
@@ -1568,7 +1582,7 @@
(is (= {"source-field-name" "PRODUCT_ID"}
(get-in out ["stages" 0 "breakout" 0 1]))))))
-(deftest source-field-join-alias-defers-to-pass-4-when-source-table-can-reach-target-test
+(deftest ^:parallel source-field-join-alias-defers-to-pass-4-when-source-table-can-reach-target-test
(testing (str "if the field's target is reachable directly from `source-table`, Pass 3.5 "
"backs off and lets the basic implicit-join pass (Pass 4) handle it - we get "
"a plain `source-field`, NOT `source-field-join-alias`")
@@ -1587,7 +1601,7 @@
(is (= ["Sample" "PUBLIC" "ORDERS" "PRODUCT_ID"] (get opts "source-field")))
(is (not (contains? opts "source-field-join-alias"))))))
-(deftest source-field-join-alias-no-op-when-no-joins-test
+(deftest ^:parallel source-field-join-alias-no-op-when-no-joins-test
(testing "when the stage has no `joins:`, Pass 3.5 doesn't touch anything; Pass 4 reports as usual"
;; CATEGORIES isn't reachable from ORDERS - no joins available either - so Pass 4 raises
;; :no-fk-path. We're asserting Pass 3.5 didn't get in the way.
@@ -1604,7 +1618,7 @@
(catch clojure.lang.ExceptionInfo e
(is (= :no-fk-path (:error (ex-data e))))))))
-(deftest source-field-join-alias-ambiguous-error-test
+(deftest ^:parallel source-field-join-alias-ambiguous-error-test
(testing "raises :ambiguous-fk-via-join when the target is reachable through multiple distinct join aliases"
(let [q (assoc-in join-base-query ["stages" 0 "joins"]
[{"alias" "P"
@@ -1641,7 +1655,7 @@
(testing "message tells the LLM how to disambiguate via `source-field-join-alias`"
(is (re-find #"source-field-join-alias" msg)))))))))
-(deftest source-field-join-alias-skips-joins-subtree-test
+(deftest ^:parallel source-field-join-alias-skips-joins-subtree-test
(testing (str "a field clause inside an explicit join's `conditions:` is NOT touched - those "
"clauses live in the join's own resolution context")
(let [out (repair/repair mp-via-join join-base-query)
@@ -1678,7 +1692,7 @@
{"lib/type" "mbql.stage/mbql"
"filters" [[">" {} ["field" {} "count"] 10]]}]})
-(deftest cross-stage-field-type-inference-happy-path-test
+(deftest ^:parallel cross-stage-field-type-inference-happy-path-test
(testing "String-named cross-stage field ref gets `base-type` + `effective-type` inferred
from the previous stage's `lib/returned-columns`."
(let [out (repair/repair mp-fks multi-stage-base-query)
@@ -1690,7 +1704,7 @@
(testing "the string column name in position 2 is preserved"
(is (= "count" (nth field-clause 2)))))))
-(deftest cross-stage-field-type-preserves-existing-base-type-test
+(deftest ^:parallel cross-stage-field-type-preserves-existing-base-type-test
(testing "If the LLM actually wrote `base-type`, we don't overwrite it."
(let [q (assoc-in multi-stage-base-query
["stages" 1 "filters" 0 2 1]
@@ -1700,7 +1714,7 @@
(is (= "type/Text" (get opts "base-type")))
(is (= "type/Text" (get opts "effective-type"))))))
-(deftest cross-stage-field-type-breakout-column-test
+(deftest ^:parallel cross-stage-field-type-breakout-column-test
(testing "A later stage can reference a BREAKOUT column from the previous stage by name;
repair infers its base-type from the source column's metadata."
(let [q {"lib/type" "mbql/query"
@@ -1715,7 +1729,7 @@
opts (get-in out ["stages" 1 "order-by" 0 2 1])]
(is (= "type/Integer" (get opts "base-type"))))))
-(deftest cross-stage-field-type-leaves-vector-field-fks-alone-test
+(deftest ^:parallel cross-stage-field-type-leaves-vector-field-fks-alone-test
(testing "A field clause that uses a portable FK path (vector in position 2) is a normal
cross-table reference, not a cross-stage one - do not touch it."
(let [out (repair/repair mp-fks multi-stage-base-query)
@@ -1725,7 +1739,7 @@
;; NOT have been stamped in by the cross-stage pass (different code path).
(is (vector? (nth stage-0-breakout-field 2)))))))
-(deftest cross-stage-field-type-no-previous-stage-test
+(deftest ^:parallel cross-stage-field-type-no-previous-stage-test
(testing "String-named field in stage 0 has no previous stage to look at - we can't
infer, so we leave the clause alone (the schema validator will surface the error)."
(let [q {"lib/type" "mbql/query"
@@ -1737,7 +1751,7 @@
opts (get-in out ["stages" 0 "filters" 0 2 1])]
(is (not (contains? opts "base-type"))))))
-(deftest cross-stage-field-type-unknown-column-name-test
+(deftest ^:parallel cross-stage-field-type-unknown-column-name-test
(testing "If the referenced name isn't produced by the previous stage, leave the clause
alone (the resolver will surface :unknown-column or similar with a better message)."
(let [q (assoc-in multi-stage-base-query
@@ -1746,7 +1760,7 @@
opts (get-in out ["stages" 1 "filters" 0 2 1])]
(is (not (contains? opts "base-type"))))))
-(deftest cross-stage-field-type-strips-surrounding-double-quotes-test
+(deftest ^:parallel cross-stage-field-type-strips-surrounding-double-quotes-test
(testing (str "BOT-1587: when the LLM quotes a cross-stage column name like a SQL identifier\n"
"(`\"count\"` instead of `count`), repair strips the surrounding double-quotes so\n"
"the name matches the previous stage's output, rewrites the ref to the canonical\n"
@@ -1763,7 +1777,7 @@
(is (= "type/Integer" (get opts "base-type")))
(is (= "type/Integer" (get opts "effective-type")))))))
-(deftest cross-stage-field-type-unmatched-quoted-name-left-alone-test
+(deftest ^:parallel cross-stage-field-type-unmatched-quoted-name-left-alone-test
(testing (str "Quote-stripping only rewrites when the stripped name matches a real column.\n"
"A quoted name whose stripped form still isn't produced by the previous stage is\n"
"left verbatim (the resolver surfaces the real error with a better message).")
@@ -1775,13 +1789,13 @@
(is (= "\"no_such_column\"" (nth field-clause 2)) "name left untouched")
(is (not (contains? opts "base-type"))))))
-(deftest cross-stage-field-type-idempotent-test
+(deftest ^:parallel cross-stage-field-type-idempotent-test
(testing "cross-stage field-type inference is idempotent"
(let [once (repair/repair mp-fks multi-stage-base-query)
twice (repair/repair mp-fks once)]
(is (= once twice)))))
-(deftest cross-stage-field-type-quoted-name-idempotent-test
+(deftest ^:parallel cross-stage-field-type-quoted-name-idempotent-test
(testing "the quote-stripping rewrite is also idempotent"
(let [q (assoc-in multi-stage-base-query
["stages" 1 "filters" 0 2 2] "\"count\"")
@@ -1789,7 +1803,7 @@
twice (repair/repair mp-fks once)]
(is (= once twice)))))
-(deftest cross-stage-field-type-end-to-end-resolve-test
+(deftest ^:parallel cross-stage-field-type-end-to-end-resolve-test
(testing (str "End-to-end: a multi-stage YAML with a stage-1 cross-stage ref lacking\n"
"base-type is repaired and then `resolve-query` + `lib/query` accept the\n"
"result without a validation error.")
@@ -1807,7 +1821,7 @@
;;; Pass 1.5 - expressions shape normalisation (repr-plan step 9)
;;; ============================================================
-(deftest expressions-map-shape-normalised-to-sequential-test
+(deftest ^:parallel expressions-map-shape-normalised-to-sequential-test
(testing "map-form `expressions:` is converted to a vector of clauses with `lib/expression-name` stamped from the key"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -1825,7 +1839,7 @@
(is (= "+" (first clause)))
(is (= "Subtotal" (get opts "lib/expression-name")))))))
-(deftest expressions-sequential-shape-passes-through-test
+(deftest ^:parallel expressions-sequential-shape-passes-through-test
(testing "sequential-form `expressions:` is left alone when each clause already carries `lib/expression-name`"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -1838,7 +1852,7 @@
(is (= (get-in q ["stages" 0 "expressions"])
(get-in repaired ["stages" 0 "expressions"]))))))
-(deftest expressions-sequential-without-name-left-alone-test
+(deftest ^:parallel expressions-sequential-without-name-left-alone-test
(testing (str "sequential-form without `lib/expression-name` is left as-is; schema\n"
"validation will surface the missing-name error rather than us making one up.")
(let [q {"lib/type" "mbql/query"
@@ -1852,7 +1866,7 @@
opts (get-in repaired ["stages" 0 "expressions" 0 1])]
(is (not (contains? opts "lib/expression-name"))))))
-(deftest expressions-map-with-existing-name-in-options-preserved-test
+(deftest ^:parallel expressions-map-with-existing-name-in-options-preserved-test
(testing (str "if a map-form entry's clause already has `lib/expression-name` in its options,\n"
"authored metadata wins and we don't overwrite it.")
(let [q {"lib/type" "mbql/query"
@@ -1867,7 +1881,7 @@
clause (get-in repaired ["stages" 0 "expressions" 0])]
(is (= "FromOpts" (get-in clause [1 "lib/expression-name"]))))))
-(deftest expressions-absent-no-op-test
+(deftest ^:parallel expressions-absent-no-op-test
(testing "stages without `expressions:` are left alone"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -1878,7 +1892,7 @@
(is (= (get-in q ["stages" 0])
(get-in repaired ["stages" 0]))))))
-(deftest expressions-idempotent-test
+(deftest ^:parallel expressions-idempotent-test
(testing "repair is idempotent on expressions: applying twice equals applying once"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -1891,7 +1905,7 @@
twice (repair/repair trivial-mp once)]
(is (= once twice)))))
-(deftest expressions-multi-stage-test
+(deftest ^:parallel expressions-multi-stage-test
(testing "expression-name stamping works across multiple stages independently"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -1915,7 +1929,7 @@
;;; Pass 2.8 - integer-index aggregation refs → canonical UUID form (repr-plan step 10)
;;; ============================================================
-(deftest aggregation-ref-integer-index-happy-path-test
+(deftest ^:parallel aggregation-ref-integer-index-happy-path-test
(testing "a 0-based integer agg-ref in order-by is rewritten to the canonical UUID form"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -1937,7 +1951,7 @@
(is (= "type/BigInteger" (get-in ref-clause [1 "base-type"])))
(is (= "type/BigInteger" (get-in ref-clause [1 "effective-type"])))))))
-(deftest aggregation-ref-preserves-authored-options-test
+(deftest ^:parallel aggregation-ref-preserves-authored-options-test
(testing "authored base-type / name in the ref's options are not overwritten"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -1955,7 +1969,7 @@
(is (= "type/Float" (get opts "effective-type")))
(is (= "custom-name" (get opts "name"))))))
-(deftest aggregation-ref-out-of-range-raises-agent-error-test
+(deftest ^:parallel aggregation-ref-out-of-range-raises-agent-error-test
(testing "an index past the stage's aggregation vector surfaces an agent-error"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -1976,7 +1990,7 @@
(is (re-find #"sum at 0" (ex-message e)))
(is (re-find #"count at 1" (ex-message e)))))))))
-(deftest aggregation-ref-string-uuid-is-idempotent-test
+(deftest ^:parallel aggregation-ref-string-uuid-is-idempotent-test
(testing "a ref whose last slot is already a UUID string is left unchanged"
(let [uuid "11111111-1111-1111-1111-111111111111"
q {"lib/type" "mbql/query"
@@ -1992,7 +2006,7 @@
(is (= uuid (get-in repaired ["stages" 0 "order-by" 0 2 2])))
(is (= uuid (get-in repaired ["stages" 0 "aggregation" 0 1 "lib/uuid"]))))))
-(deftest aggregation-ref-no-aggregations-in-stage-raises-agent-error-test
+(deftest ^:parallel aggregation-ref-no-aggregations-in-stage-raises-agent-error-test
(testing "`[aggregation, {}, 0]` with no `aggregation:` clause in the stage is an agent-error"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2007,7 +2021,7 @@
(is (true? (:agent-error? d)))
(is (= :aggregation-ref-no-aggregations (:error d)))))))))
-(deftest aggregation-ref-noop-when-no-int-refs-test
+(deftest ^:parallel aggregation-ref-noop-when-no-int-refs-test
(testing "a stage without integer-indexed agg-refs is left alone by this pass"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2019,7 +2033,7 @@
(is (= [["count" {}]]
(get-in repaired ["stages" 0 "aggregation"]))))))
-(deftest aggregation-ref-idempotent-test
+(deftest ^:parallel aggregation-ref-idempotent-test
(testing "repair is a fixed point under repeated application"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2034,7 +2048,7 @@
twice (repair/repair trivial-mp once)]
(is (= once twice)))))
-(deftest aggregation-ref-type-inference-by-head-test
+(deftest ^:parallel aggregation-ref-type-inference-by-head-test
(testing "base-type inference from aggregation head"
(let [mk (fn [agg-clause]
{"lib/type" "mbql/query"
@@ -2059,7 +2073,7 @@
(testing "unknown head → type/*"
(is (= "type/*" (type-of ["some-new-agg-fn" {}])))))))
-(deftest aggregation-ref-multi-stage-same-stage-ref-test
+(deftest ^:parallel aggregation-ref-multi-stage-same-stage-ref-test
(testing "a later stage can use integer agg-ref against its own aggregation list"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2082,7 +2096,7 @@
;;; Pass 2.9 - auto-split post-aggregation filter into a second stage
;;; ============================================================
-(deftest split-post-agg-filter-simple-count-test
+(deftest ^:parallel split-post-agg-filter-simple-count-test
(testing "filter [> count 10] on stage with aggregation [count] is split into two stages"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2106,7 +2120,7 @@
(is (= [[">" {} ["field" {} "count"] 10]]
(get-in stages [1 "filters"])))))))
-(deftest split-post-agg-filter-keeps-pre-agg-filters-test
+(deftest ^:parallel split-post-agg-filter-keeps-pre-agg-filters-test
(testing "pre-agg filters stay in stage 0; only the post-agg filter moves"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2125,7 +2139,7 @@
(is (= [[">" {} ["field" {} "count"] 10]]
(get-in stages [1 "filters"])))))))
-(deftest split-post-agg-refuses-when-order-by-present-test
+(deftest ^:parallel split-post-agg-refuses-when-order-by-present-test
(testing (str "post-agg filter + `order-by` in the same stage is refused with a clean "
":agent-error? — auto-relocating ordering is unsafe (the order-by may "
"reference a pre-agg column that doesn't survive the split, and forcing the "
@@ -2148,7 +2162,7 @@
(testing "diagnostic names the offending stage shape"
(is (re-find #"order-by" (ex-message e))))))))))
-(deftest split-post-agg-refuses-when-limit-present-test
+(deftest ^:parallel split-post-agg-refuses-when-limit-present-test
(testing "post-agg filter + bare `limit` in the same stage is also refused"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2164,7 +2178,7 @@
(catch clojure.lang.ExceptionInfo e
(is (= :post-agg-filter-with-trailing-clauses (:error (ex-data e)))))))))
-(deftest split-post-agg-refuses-when-fields-present-test
+(deftest ^:parallel split-post-agg-refuses-when-fields-present-test
(testing "post-agg filter + `fields` in the same stage is also refused"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2180,7 +2194,7 @@
(catch clojure.lang.ExceptionInfo e
(is (= :post-agg-filter-with-trailing-clauses (:error (ex-data e)))))))))
-(deftest split-post-agg-refuses-when-raw-column-order-by-test
+(deftest ^:parallel split-post-agg-refuses-when-raw-column-order-by-test
(testing (str "specifically the pre-agg `order-by [desc TOTAL]` case the reviewer flagged "
"as silent-intent-destruction in the prior implementation: TOTAL doesn't "
"survive aggregation and naively moving it to stage 1 produced either a "
@@ -2201,7 +2215,7 @@
(catch clojure.lang.ExceptionInfo e
(is (= :post-agg-filter-with-trailing-clauses (:error (ex-data e)))))))))
-(deftest split-post-agg-uses-name-override-when-present-test
+(deftest ^:parallel split-post-agg-uses-name-override-when-present-test
(testing "an aggregation with `name` override produces a cross-stage ref by that name"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2215,7 +2229,7 @@
(is (= [[">" {} ["field" {} "Total Orders"] 10]]
(get-in stages [1 "filters"]))))))
-(deftest split-post-agg-multiple-aggregations-test
+(deftest ^:parallel split-post-agg-multiple-aggregations-test
(testing "with multiple aggregations of DIFFERENT heads, each gets its own column-name mapping"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2232,7 +2246,7 @@
[">" {} ["field" {} "sum"] 100]]
(get-in stages [1 "filters"]))))))
-(deftest split-post-agg-refuses-on-duplicate-column-names-test
+(deftest ^:parallel split-post-agg-refuses-on-duplicate-column-names-test
(testing (str "two `sum` aggregations on different fields would both map to the static "
"column name \"sum\"; lib's `unique-name-generator` would dedup to "
"`sum` / `sum_2` based on field order, which our static table cannot "
@@ -2262,7 +2276,7 @@
(testing "message offers the `name` opts override as a remedy"
(is (re-find #"name" msg)))))))))
-(deftest split-post-agg-same-head-with-name-overrides-test
+(deftest ^:parallel split-post-agg-same-head-with-name-overrides-test
(testing (str "explicit `name` opts override resolves the duplicate-name collision: the "
"user gets the split they intended.")
(let [q {"lib/type" "mbql/query"
@@ -2283,7 +2297,7 @@
(is (= [[">" {} ["field" {} "sum_tax"] 100]]
(get-in stages [1 "filters"])))))))
-(deftest split-post-agg-metric-emits-diagnostic-test
+(deftest ^:parallel split-post-agg-metric-emits-diagnostic-test
(testing "metric aggregation we can't auto-resolve raises clean :agent-error?"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2298,7 +2312,7 @@
(is (true? (:agent-error? (ex-data e))))
(is (= :post-agg-filter-needs-multi-stage (:error (ex-data e)))))))))
-(deftest split-post-agg-no-trigger-when-no-agg-ref-test
+(deftest ^:parallel split-post-agg-no-trigger-when-no-agg-ref-test
(testing "stage with aggregation but no agg-ref-filter is left alone"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2309,7 +2323,7 @@
stages (get (repair/repair trivial-mp q) "stages")]
(is (= 1 (count stages))))))
-(deftest split-post-agg-no-trigger-when-no-aggregations-test
+(deftest ^:parallel split-post-agg-no-trigger-when-no-aggregations-test
(testing "stage with no aggregations is never split, even if filter has an aggregation-ref shape"
;; The agg-ref points to nothing in this stage - resolve-aggregation-ref-indexes will
;; have already raised. We just verify split doesn't add a phantom stage on its own.
@@ -2321,7 +2335,7 @@
stages (get (repair/repair trivial-mp q) "stages")]
(is (= 1 (count stages))))))
-(deftest split-post-agg-idempotent-test
+(deftest ^:parallel split-post-agg-idempotent-test
(testing "repair on an already-split query is a no-op"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2335,7 +2349,7 @@
(is (= 2 (count (get once "stages"))))
(is (= once twice)))))
-(deftest split-post-agg-handles-distinct-and-count-where-test
+(deftest ^:parallel split-post-agg-handles-distinct-and-count-where-test
(testing "distinct and count-where get correct lib column names"
(let [build (fn [agg]
{"lib/type" "mbql/query"
@@ -2361,7 +2375,7 @@
;;; ----- E1: [field, ...] in aggregation block ---------------------------------------
-(deftest friendly-error-field-as-aggregation-entry-test
+(deftest ^:parallel friendly-error-field-as-aggregation-entry-test
(testing "a `[field, ...]` directly inside `aggregation:` raises clean :agent-error?"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2380,7 +2394,7 @@
(is (re-find #"aggregation" (ex-message e)))
(is (re-find #"breakout" (ex-message e)))))))))
-(deftest friendly-error-canonical-aggregation-passes-test
+(deftest ^:parallel friendly-error-canonical-aggregation-passes-test
(testing "canonical aggregation entries (count, sum, avg, metric) do NOT trigger"
(doseq [agg [["count" {}]
["sum" {} ["field" {} ["Sample" "PUBLIC" "ORDERS" "TOTAL"]]]
@@ -2393,7 +2407,7 @@
"aggregation" [agg]}]}]
(is (some? (repair/repair trivial-mp q)) (str "should not throw on " agg))))))
-(deftest friendly-error-field-nested-inside-aggregation-passes-test
+(deftest ^:parallel friendly-error-field-nested-inside-aggregation-passes-test
(testing "a `field` clause NESTED inside an aggregation (its argument) does NOT trigger"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2402,7 +2416,7 @@
"aggregation" [["sum" {} ["field" {} ["Sample" "PUBLIC" "ORDERS" "TOTAL"]]]]}]}]
(is (some? (repair/repair trivial-mp q))))))
-(deftest friendly-error-multi-stage-stage-index-test
+(deftest ^:parallel friendly-error-multi-stage-stage-index-test
(testing "multi-stage: error names the correct stage index"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2420,7 +2434,7 @@
;;; ----- E2: case/if with "default" in opts ------------------------------------------
-(deftest friendly-error-case-default-in-opts-test
+(deftest ^:parallel friendly-error-case-default-in-opts-test
(testing "`case` with `default` in options raises clean :agent-error?"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2449,7 +2463,7 @@
(catch clojure.lang.ExceptionInfo e
(is (= :case-default-in-opts (:error (ex-data e)))))))))
-(deftest friendly-error-case-canonical-default-passes-test
+(deftest ^:parallel friendly-error-case-canonical-default-passes-test
(testing "canonical `case` with default as 3rd arg does NOT trigger"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2470,7 +2484,7 @@
;;; ----- E3: sexp-legacy top-level ops used as clause heads --------------------------
-(deftest friendly-error-sexp-legacy-aggregate-test
+(deftest ^:parallel friendly-error-sexp-legacy-aggregate-test
(testing "`[aggregate, ...]` as a clause head raises clean :agent-error?"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2487,7 +2501,7 @@
(is (= "aggregate" (:head data)))
(is (re-find #"top-level operation" (ex-message e)))))))))
-(deftest friendly-error-sexp-legacy-filter-test
+(deftest ^:parallel friendly-error-sexp-legacy-filter-test
(testing "`[filter, ...]` as a clause head triggers"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2500,7 +2514,7 @@
(catch clojure.lang.ExceptionInfo e
(is (= "filter" (:head (ex-data e)))))))))
-(deftest friendly-error-sexp-legacy-each-op-mentioned-test
+(deftest ^:parallel friendly-error-sexp-legacy-each-op-mentioned-test
(testing "every legacy op (aggregate/filter/order-by/breakout/limit) is recognised"
(doseq [head ["aggregate" "filter" "order-by" "breakout" "limit"]]
(let [q {"lib/type" "mbql/query"
@@ -2517,7 +2531,7 @@
(catch clojure.lang.ExceptionInfo e
(is (= head (:head (ex-data e))) (str "head mismatch for " head))))))))
-(deftest friendly-error-canonical-stage-keys-pass-test
+(deftest ^:parallel friendly-error-canonical-stage-keys-pass-test
(testing "canonical stage-level keys (aggregation:, filters:, etc.) do NOT trigger"
;; The sexp-legacy detector targets clause heads (vector slot-0 strings), not stage
;; map keys. A perfectly valid stage with `aggregation:` / `filters:` keys passes.
@@ -2534,7 +2548,7 @@
;;; ----- E4: `[measure, ...]` was historically rejected; now a first-class clause -----
-(deftest measure-clause-passes-repair-test
+(deftest ^:parallel measure-clause-passes-repair-test
(testing (str "`[measure, {}, <portable_entity_id>]` is a first-class aggregation clause "
"(was rejected by the now-deleted E4 sexp-legacy-measure-error! check). "
"Lookup/resolution happens in the resolve layer, not repair.")
@@ -2545,7 +2559,7 @@
"aggregation" [["measure" {} "@card-1"]]}]}]
(is (some? (repair/repair trivial-mp q))))))
-(deftest friendly-error-canonical-metric-passes-test
+(deftest ^:parallel friendly-error-canonical-metric-passes-test
(testing "canonical `[metric, {}, <portable_entity_id>]` does NOT trigger E4"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2556,7 +2570,7 @@
;;; ----- E5: blank [expression, opts, ""] reference ----------------------------------
-(deftest friendly-error-blank-expression-ref-test
+(deftest ^:parallel friendly-error-blank-expression-ref-test
(testing "`[expression, {}, \"\"]` blank ref raises clean :agent-error?"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2595,7 +2609,7 @@
(catch clojure.lang.ExceptionInfo e
(is (= :blank-expression-ref (:error (ex-data e)))))))))
-(deftest friendly-error-non-blank-expression-ref-passes-test
+(deftest ^:parallel friendly-error-non-blank-expression-ref-passes-test
(testing "valid `[expression, {}, \"my-expr\"]` does NOT trigger"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2608,7 +2622,7 @@
;;; ----- E6: numeric [field, opts, 100] (sexp legacy form) ---------------------------
-(deftest friendly-error-numeric-field-id-test
+(deftest ^:parallel friendly-error-numeric-field-id-test
(testing "`[field, {}, 100]` (numeric id) raises clean :agent-error?"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2625,7 +2639,7 @@
(is (re-find #"portable FK" (ex-message e)))
(is (re-find #"column-name" (ex-message e)))))))))
-(deftest friendly-error-portable-fk-passes-test
+(deftest ^:parallel friendly-error-portable-fk-passes-test
(testing "canonical portable-FK `[field, {}, [Sample, PUBLIC, ORDERS, COL]]` does NOT trigger"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
@@ -2634,7 +2648,7 @@
"filters" [["=" {} ["field" {} ["Sample" "PUBLIC" "ORDERS" "STATUS"]] "x"]]}]}]
(is (some? (repair/repair trivial-mp q))))))
-(deftest friendly-error-cross-stage-string-col-passes-test
+(deftest ^:parallel friendly-error-cross-stage-string-col-passes-test
(testing "cross-stage string column-name `[field, {}, \"count\"]` does NOT trigger"
(let [q {"lib/type" "mbql/query"
"database" "Sample"
diff --git a/test/metabase/app_db/schema_migrations_test.clj b/test/metabase/app_db/schema_migrations_test.clj
index eeb8f9ac3b5..13629e33c21 100644
--- a/test/metabase/app_db/schema_migrations_test.clj
+++ b/test/metabase/app_db/schema_migrations_test.clj
@@ -2915,7 +2915,9 @@
(is (= "librarylibrarydatadat"
(collection-entity-id data-id)))
(is (= "librarylibrarymetrics"
- (collection-entity-id metrics-id))))))
+ (collection-entity-id metrics-id)))))))
+
+(deftest backfill-legacy-library-root-collection-entity-ids-test-2
(testing "ambiguous Library Data direct children are not modified"
(impl/test-migrations ["v62.2026-05-13T12:00:00" "v62.2026-05-13T12:00:02"] [migrate!]
(let [library-id (insert-legacy-library-collection! {:name "Library"
@@ -2945,7 +2947,9 @@
(is (= "legacy-other-data"
(collection-entity-id duplicate-data-id)))
(is (= "librarylibrarymetrics"
- (collection-entity-id metrics-id))))))
+ (collection-entity-id metrics-id)))))))
+
+(deftest backfill-legacy-library-root-collection-entity-ids-test-3
(testing "Library Data collections outside Library root do not count as ambiguous"
(impl/test-migrations ["v62.2026-05-13T12:00:00" "v62.2026-05-13T12:00:02"] [migrate!]
(let [library-id (insert-legacy-library-collection! {:name "Library"
diff --git a/test/metabase/channel/render/body_test.clj b/test/metabase/channel/render/body_test.clj
index a073a22eb7e..baf5bfdd06d 100644
--- a/test/metabase/channel/render/body_test.clj
+++ b/test/metabase/channel/render/body_test.clj
@@ -245,35 +245,43 @@
:content
last))
-(deftest scalar-test
+(deftest ^:parallel scalar-test
(testing "renders int"
(is (= "10"
(render-scalar-value {:cols [{:name "ID",
:display_name "ID",
:base_type :type/BigInteger
:semantic_type nil}]
- :rows [[10]]}))))
+ :rows [[10]]})))))
+
+(deftest ^:parallel scalar-test-2
(testing "renders float"
(is (= "10.12"
(render-scalar-value {:cols [{:name "floatnum",
:display_name "FLOATNUM",
:base_type :type/Float
:semantic_type nil}]
- :rows [[10.12345]]}))))
+ :rows [[10.12345]]})))))
+
+(deftest ^:parallel scalar-test-3
(testing "renders string"
(is (= "foo"
(render-scalar-value {:cols [{:name "stringvalue",
:display_name "STRINGVALUE",
:base_type :type/Text
:semantic_type nil}]
- :rows [["foo"]]}))))
+ :rows [["foo"]]})))))
+
+(deftest ^:parallel scalar-test-4
(testing "renders date"
(is (= "April 1, 2014, 8:30 AM"
(render-scalar-value {:cols [{:name "date",
:display_name "DATE",
:base_type :type/DateTime
:semantic_type nil}]
- :rows [["2014-04-01T08:30:00.0000"]]}))))
+ :rows [["2014-04-01T08:30:00.0000"]]})))))
+
+(deftest ^:parallel scalar-test-5
(testing "Includes raw text"
(testing "for scalars"
(let [results {:cols [{:name "stringvalue",
diff --git a/test/metabase/collections/models/collection_test.clj b/test/metabase/collections/models/collection_test.clj
index 668203f2392..04106386454 100644
--- a/test/metabase/collections/models/collection_test.clj
+++ b/test/metabase/collections/models/collection_test.clj
@@ -973,7 +973,9 @@
(is (= {"A" {"B" {}
"C" {"D" {"E" {}}
"F" {"G" {}}}}}
- (collection-locations (vals collections))))))
+ (collection-locations (vals collections)))))))
+
+(deftest move-nested-collections-test-2
(testing "Test that we can move a Collection"
;;
;; +-> B +-> B ---> E
@@ -986,7 +988,9 @@
(is (= {"A" {"B" {"E" {}}
"C" {"D" {}
"F" {"G" {}}}}}
- (collection-locations (vals collections))))))
+ (collection-locations (vals collections)))))))
+
+(deftest move-nested-collections-test-3
(testing "Test that we can move a Collection and its descendants get moved as well"
;;
;; +-> B +-> B ---> D -> E
@@ -998,7 +1002,9 @@
(collection/move-collection! d (collection/children-location b))
(is (= {"A" {"B" {"D" {"E" {}}}
"C" {"F" {"G" {}}}}}
- (collection-locations (vals collections))))))
+ (collection-locations (vals collections)))))))
+
+(deftest move-nested-collections-test-4
(testing "Test that we can move a Collection into the Root Collection"
;;
;; +-> B +-> B
@@ -1011,7 +1017,9 @@
(is (= {"A" {"B" {}
"C" {"D" {"E" {}}}}
"F" {"G" {}}}
- (collection-locations (vals collections))))))
+ (collection-locations (vals collections)))))))
+
+(deftest move-nested-collections-test-5
(testing "Test that we can move a Collection out of the Root Collection"
;;
;; +-> B +-> B
@@ -1362,7 +1370,9 @@
(t2/update! :model/Collection (u/the-id b) {:location (collection/children-location c)})
(is (= #{"/collection/B/"
"/collection/C/"}
- (group->perms [a b c] group)))))))
+ (group->perms [a b c] group))))))))
+
+(deftest move-from-personal-to-impersonal-test-2
(testing "Perms should apply recursively as well..."
;; Personal Collection > A > B Personal Collection
;; ===>
diff --git a/test/metabase/dashboards_rest/api_test.clj b/test/metabase/dashboards_rest/api_test.clj
index 2ee7b363bdb..bd9f95c7ed3 100644
--- a/test/metabase/dashboards_rest/api_test.clj
+++ b/test/metabase/dashboards_rest/api_test.clj
@@ -1216,7 +1216,9 @@
(is (not= dash-id (:id response)))
(let [copied-cards (t2/select :model/Card :dashboard_id (:id response))]
(is (= 1 (count copied-cards)))
- (is (not= card-id (:id (first copied-cards))))))))
+ (is (not= card-id (:id (first copied-cards)))))))))
+
+(deftest copy-dashboard-with-dashboard-questions-2
(testing "`is_deep_copy=false` errors for dashboards containing dashboard questions"
(mt/with-temp [:model/Collection {coll-id :id} {}
:model/Dashboard {dash-id :id} {:collection_id coll-id}
@@ -1227,7 +1229,9 @@
(is (= "You cannot do a shallow copy of this dashboard because it contains Dashboard Questions."
(mt/user-http-request :rasta :post 400
(format "dashboard/%d/copy" dash-id)
- {:is_deep_copy false})))))
+ {:is_deep_copy false}))))))
+
+(deftest copy-dashboard-with-dashboard-questions-3
(testing "`is_deep_copy=false` works for a dashboard without any dashboard questions"
(mt/with-temp [:model/Collection {coll-id :id} {}
:model/Dashboard {dash-id :id} {:collection_id coll-id}
@@ -1239,7 +1243,9 @@
{:is_deep_copy false})]
(is (some? (:id response)))
(is (not= dash-id (:id response)))
- (is (zero? (t2/count :model/Card :dashboard_id (:id response)))))))
+ (is (zero? (t2/count :model/Card :dashboard_id (:id response))))))))
+
+(deftest copy-dashboard-with-dashboard-questions-4
(testing "`is_deep_copy=false` works for a dashboard with archived dashboard questions"
(mt/with-temp [:model/Collection {coll-id :id} {}
:model/Dashboard {dash-id :id} {:collection_id coll-id}
@@ -1643,7 +1649,9 @@
2 {:id 2}
3 {:id 3}}
{1 10
- 2 20})))))
+ 2 20}))))))
+
+(deftest update-cards-for-copy-test-2
(testing "When copy style is deep"
(let [dashcards [{:card_id 1 :card {:id 1} :series [{:id 2} {:id 3}]}]]
(testing "Can omit series cards"
diff --git a/test/metabase/driver/postgres_test.clj b/test/metabase/driver/postgres_test.clj
index 89ac199e587..d0fb2e7a0dd 100644
--- a/test/metabase/driver/postgres_test.clj
+++ b/test/metabase/driver/postgres_test.clj
@@ -149,7 +149,9 @@
:host "localhost"
:port 5432
:dbname "bird_sightings"
- :user "camsaul"}))))
+ :user "camsaul"})))))
+
+(deftest ^:parallel connection-details->spec-test-2
(testing "ssl - check that expected params get added"
(is (= {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
@@ -165,7 +167,9 @@
:host "localhost"
:port 5432
:dbname "bird_sightings"
- :user "camsaul"}))))
+ :user "camsaul"})))))
+
+(deftest ^:parallel connection-details->spec-test-3
(testing "make sure connection details w/ extra params work as expected"
(is (= {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
@@ -177,7 +181,9 @@
{:host "localhost"
:port "5432"
:dbname "cool"
- :additional-options "prepareThreshold=0"}))))
+ :additional-options "prepareThreshold=0"})))))
+
+(deftest ^:parallel connection-details->spec-test-4
(testing "user-specified SSL options should always take precendence over defaults"
(is (= {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
diff --git a/test/metabase/driver/util_test.clj b/test/metabase/driver/util_test.clj
index 689650cdd7d..60081e1dfa8 100644
--- a/test/metabase/driver/util_test.clj
+++ b/test/metabase/driver/util_test.clj
@@ -230,20 +230,26 @@
(#'driver.u/resolve-transitive-visible-if
c
props-by-name
- :test-driver))))))
+ :test-driver)))))))
+
+(deftest ^:parallel resolve-transitive-visible-if-test-2
(testing "empty visible-if is removed"
(is (= {:name "prop-x"}
(#'driver.u/resolve-transitive-visible-if
{:name "prop-x" :visible-if {}}
{}
- :test-driver))))
+ :test-driver)))))
+
+(deftest ^:parallel resolve-transitive-visible-if-test-3
(testing "dependencies on non-existent properties are kept (not filtered)"
(let [props-by-name {"prop-a" {:name "prop-a"}}]
(is (= {:name "prop-b" :visible-if {:non-existent-prop true}}
(#'driver.u/resolve-transitive-visible-if
{:name "prop-b" :visible-if {:non-existent-prop true}}
props-by-name
- :test-driver)))))
+ :test-driver))))))
+
+(deftest ^:parallel resolve-transitive-visible-if-test-4
(testing "false dependencies (from removed :checked-section) are filtered out"
(let [props-by-name {"prop-a" {:name "prop-a"}}]
(is (= {:name "prop-b" :visible-if {:prop-a true}}
@@ -251,7 +257,9 @@
{:name "prop-b" :visible-if {:prop-a true
:removed-section false}}
props-by-name
- :test-driver)))))
+ :test-driver))))))
+
+(deftest ^:parallel resolve-transitive-visible-if-test-5
(testing "multi-level transitive dependencies are fully resolved"
(let [props-by-name {"prop-a" {:name "prop-a"}
"prop-b" {:name "prop-b" :visible-if {:prop-a true}}
@@ -263,7 +271,9 @@
(#'driver.u/resolve-transitive-visible-if
{:name "prop-d" :visible-if {:prop-c true}}
props-by-name
- :test-driver)))))
+ :test-driver))))))
+
+(deftest ^:parallel resolve-transitive-visible-if-test-6
(testing "cycle detection throws exception with appropriate error data"
(let [props-by-name {"prop-a" {:name "prop-a" :visible-if {:prop-c true}}
"prop-b" {:name "prop-b" :visible-if {:prop-a true}}
diff --git a/test/metabase/frontend_errors/api_test.clj b/test/metabase/frontend_errors/api_test.clj
index fcd2270f439..ae25aaec205 100644
--- a/test/metabase/frontend_errors/api_test.clj
+++ b/test/metabase/frontend_errors/api_test.clj
@@ -33,16 +33,22 @@
(mt/with-prometheus-system! [_ system]
(let [initial (mt/metric-value system :metabase-frontend/errors {:type "component-crash"})]
(is (nil? (mt/user-http-request :rasta :post 204 "frontend-errors" {:type "component-crash"})))
- (is (< initial (mt/metric-value system :metabase-frontend/errors {:type "component-crash"}))))))
+ (is (< initial (mt/metric-value system :metabase-frontend/errors {:type "component-crash"})))))))
+
+(deftest post-frontend-errors-test-2
(testing "POST /api/frontend-errors with type=chart-render-error tracks separately"
(mt/with-prometheus-system! [_ system]
(let [initial (mt/metric-value system :metabase-frontend/errors {:type "chart-render-error"})]
(mt/user-http-request :rasta :post 204 "frontend-errors" {:type "chart-render-error"})
- (is (< initial (mt/metric-value system :metabase-frontend/errors {:type "chart-render-error"}))))))
+ (is (< initial (mt/metric-value system :metabase-frontend/errors {:type "chart-render-error"})))))))
+
+(deftest post-frontend-errors-test-3
(testing "POST /api/frontend-errors rejects unknown type values"
(is (= {:errors {:type "enum of component-crash, chart-render-error"}}
(select-keys (mt/user-http-request :rasta :post 400 "frontend-errors" {:type "bogus"})
- [:errors]))))
+ [:errors])))))
+
+(deftest post-frontend-errors-test-4
(testing "POST /api/frontend-errors is throttled for the same IP once the threshold is exceeded"
(mt/with-prometheus-system! [_ system]
(with-throttled-frontend-errors
@@ -57,7 +63,10 @@
count-after-throttling (mt/metric-value system :metabase-frontend/errors {:type "component-crash"})]
(is (< initial-count count-after-first-request))
(is (= count-after-first-request count-after-throttling))
- (is (=? throttled-response resp))))))
+ (is (=? throttled-response resp))))))))
+
+(deftest post-frontend-errors-test-5
+ (testing "POST /api/frontend-errors is throttled for the same IP once the threshold is exceeded"
(testing "POST /api/frontend-errors throttles requests from the same IP even if the browser ID changes"
(mt/with-prometheus-system! [_ system]
(with-throttled-frontend-errors
@@ -71,7 +80,10 @@
{:type "component-crash"})
count-after-throttling (mt/metric-value system :metabase-frontend/errors {:type "component-crash"})]
(is (= (inc initial-count) count-after-throttling))
- (is (=? throttled-response resp)))))))
+ (is (=? throttled-response resp)))))))))
+
+(deftest post-frontend-errors-test-6
+ (testing "POST /api/frontend-errors is throttled for the same IP once the threshold is exceeded"
(testing "POST /api/frontend-errors throttles repeated requests from the same IP even without a browser cookie"
(mt/with-prometheus-system! [_ system]
(with-throttled-frontend-errors
@@ -84,7 +96,10 @@
{:type "component-crash"})
count-after-throttling (mt/metric-value system :metabase-frontend/errors {:type "component-crash"})]
(is (= (inc initial-count) count-after-throttling))
- (is (=? throttled-response resp)))))))
+ (is (=? throttled-response resp)))))))))
+
+(deftest post-frontend-errors-test-7
+ (testing "POST /api/frontend-errors is throttled for the same IP once the threshold is exceeded"
(testing "POST /api/frontend-errors throttles repeated invalid payloads before validation"
(with-throttled-frontend-errors
(let [request-options (request-options "device-a")]
diff --git a/test/metabase/lib/field_test.cljc b/test/metabase/lib/field_test.cljc
index 25c58fbea16..3f2dd9f0fde 100644
--- a/test/metabase/lib/field_test.cljc
+++ b/test/metabase/lib/field_test.cljc
@@ -909,14 +909,18 @@
[:field {} (meta/id :orders :user-id)]]
(-> (lib/query meta/metadata-provider (meta/table-metadata :orders))
(#'lib.field/populate-fields-for-stage -1)
- fields-of))))
+ fields-of)))))
+
+(deftest ^:parallel populate-fields-for-stage-test-2
(testing "aggregated"
(let [query (-> (lib/query meta/metadata-provider (meta/table-metadata :orders))
(lib/aggregate -1 (lib/count)))]
(is (=? [[:aggregation {} (-> query lib/aggregations first lib.options/uuid)]]
(-> query
(#'lib.field/populate-fields-for-stage -1)
- fields-of)))))
+ fields-of))))))
+
+(deftest ^:parallel populate-fields-for-stage-test-3
(testing "aggregated with breakout"
(let [query (-> (lib/query meta/metadata-provider (meta/table-metadata :orders))
(lib/aggregate -1 (lib/count)))
@@ -927,7 +931,9 @@
[:aggregation {} (-> query lib/aggregations first lib.options/uuid)]])
(-> query
(#'lib.field/populate-fields-for-stage -1)
- fields-of)))))
+ fields-of))))))
+
+(deftest ^:parallel populate-fields-for-stage-test-4
(testing "explicit join fields are *not* included"
(let [query (as-> (meta/table-metadata :orders) <>
(lib/query meta/metadata-provider <>)
@@ -954,7 +960,9 @@
(-> query
(lib.util/update-query-stage -1 update-in [:joins 0] lib/with-join-fields (take 3 returned))
(#'lib.field/populate-fields-for-stage -1)
- fields-of)))))))
+ fields-of))))))))
+
+(deftest ^:parallel populate-fields-for-stage-test-5
(testing "sourced from another card"
(let [query (lib.tu/query-with-source-card)]
(testing "starts with no :fields"
diff --git a/test/metabase/lib/native_test.cljc b/test/metabase/lib/native_test.cljc
index b5f82d630f5..247ea92fa36 100644
--- a/test/metabase/lib/native_test.cljc
+++ b/test/metabase/lib/native_test.cljc
@@ -55,7 +55,9 @@
:snippet-name "foo"
:snippet-id 1
:id string?}}
- (lib.native/extract-template-tags metadata-provider "SELECT * FROM {{snippet: foo}} WHERE {{snippet:foo}}")))))
+ (lib.native/extract-template-tags metadata-provider "SELECT * FROM {{snippet: foo}} WHERE {{snippet:foo}}"))))))
+
+(deftest ^:parallel template-tags-test-2
(testing "renaming a variable"
(let [old-tag {:type :text
:name "foo"
@@ -87,7 +89,9 @@
:id (:id old-tag)}}
(lib.native/extract-template-tags meta/metadata-provider "SELECT * FROM {{bar}} AND field = {{other}}"
{"foo" old-tag
- "other" other})))))))
+ "other" other}))))))))
+
+(deftest ^:parallel template-tags-test-3
(testing "general case, add and remove"
(let [mktag (fn [base]
(merge {:type :text
diff --git a/test/metabase/lib/validate_test.cljc b/test/metabase/lib/validate_test.cljc
index 6681a4deaf9..4a6d6838ead 100644
--- a/test/metabase/lib/validate_test.cljc
+++ b/test/metabase/lib/validate_test.cljc
@@ -1,6 +1,6 @@
(ns metabase.lib.validate-test
(:require
- [clojure.test :refer [deftest ^:parallel is testing]]
+ [clojure.test :refer [deftest is testing]]
[medley.core :as m]
[metabase.lib.core :as lib]
[metabase.lib.metadata :as lib.metadata]
diff --git a/test/metabase/lib/walk/util_test.cljc b/test/metabase/lib/walk/util_test.cljc
index 61413e8a3bb..90d4a5386d3 100644
--- a/test/metabase/lib/walk/util_test.cljc
+++ b/test/metabase/lib/walk/util_test.cljc
@@ -110,7 +110,9 @@
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
:fields [[:field $venues.name {:source-field %checkins.venue-id}]
- [:field $users.name {:source-field %checkins.user-id}]]}))))))
+ [:field $users.name {:source-field %checkins.user-id}]]})))))))
+
+(deftest ^:parallel all-implicitly-joined-field-ids-test-2
(testing "Ignores explicit joins (fields with both :source-field and :join-alias)"
(is (= #{}
(lib/all-implicitly-joined-field-ids
@@ -122,7 +124,9 @@
:join-alias "V"}]]
:joins [{:source-table $$venues
:alias "V"
- :condition [:= $checkins.venue-id &V.venues.id]}]}))))))
+ :condition [:= $checkins.venue-id &V.venues.id]}]})))))))
+
+(deftest ^:parallel all-implicitly-joined-field-ids-test-3
(testing "Works with breakouts and aggregations"
(is (= (lib.tu.macros/$ids nil #{%venues.name})
(lib/all-implicitly-joined-field-ids
@@ -131,7 +135,9 @@
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
:breakout [[:field $venues.name {:source-field %checkins.venue-id}]]
- :aggregation [[:count]]}))))))
+ :aggregation [[:count]]})))))))
+
+(deftest ^:parallel all-implicitly-joined-field-ids-test-4
(testing "Works with filters"
(is (= (lib.tu.macros/$ids nil #{%venues.name})
(lib/all-implicitly-joined-field-ids
@@ -139,7 +145,9 @@
meta/metadata-provider
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
- :filter [:= [:field $venues.name {:source-field %checkins.venue-id}] "Bird's Nest"]}))))))
+ :filter [:= [:field $venues.name {:source-field %checkins.venue-id}] "Bird's Nest"]})))))))
+
+(deftest ^:parallel all-implicitly-joined-field-ids-test-5
(testing "Works with aggregations"
(is (= (lib.tu.macros/$ids nil #{%venues.price})
(lib/all-implicitly-joined-field-ids
@@ -147,7 +155,9 @@
meta/metadata-provider
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
- :aggregation [[:sum [:field $venues.price {:source-field %checkins.venue-id}]]]}))))))
+ :aggregation [[:sum [:field $venues.price {:source-field %checkins.venue-id}]]]})))))))
+
+(deftest ^:parallel all-implicitly-joined-field-ids-test-6
(testing "Works with order-by"
(is (= (lib.tu.macros/$ids nil #{%venues.name})
(lib/all-implicitly-joined-field-ids
@@ -155,7 +165,9 @@
meta/metadata-provider
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
- :order-by [[:asc [:field $venues.name {:source-field %checkins.venue-id}]]]}))))))
+ :order-by [[:asc [:field $venues.name {:source-field %checkins.venue-id}]]]})))))))
+
+(deftest ^:parallel all-implicitly-joined-field-ids-test-7
(testing "Works in join conditions"
(is (= (lib.tu.macros/$ids nil #{%categories.name})
(lib/all-implicitly-joined-field-ids
@@ -165,7 +177,9 @@
{:source-table $$venues
:joins [{:source-table $$users
:alias "U"
- :condition [:= [:field $categories.name {:source-field %venues.category-id}] &U.users.name]}]}))))))
+ :condition [:= [:field $categories.name {:source-field %venues.category-id}] &U.users.name]}]})))))))
+
+(deftest ^:parallel all-implicitly-joined-field-ids-test-8
(testing "Ignores string field names (should only collect integer field IDs) - GHY-3085"
(mu/disable-enforcement
(is (= #{}
@@ -181,7 +195,9 @@
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
:fields [[:field $venues.name {:source-field %checkins.venue-id}]
- [:field $users.name {:source-field %checkins.user-id}]]}))))))
+ [:field $users.name {:source-field %checkins.user-id}]]})))))))
+
+(deftest ^:parallel all-implicitly-joined-table-ids-test-2
(testing "Returns empty set when no implicit joins"
(is (= nil
(lib/all-implicitly-joined-table-ids
@@ -189,7 +205,9 @@
meta/metadata-provider
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
- :fields [$checkins.id $checkins.date]}))))))
+ :fields [$checkins.id $checkins.date]})))))))
+
+(deftest ^:parallel all-implicitly-joined-table-ids-test-3
(testing "Ignores explicit joins"
(is (= nil
(lib/all-implicitly-joined-table-ids
@@ -201,7 +219,9 @@
:join-alias "V"}]]
:joins [{:source-table $$venues
:alias "V"
- :condition [:= $checkins.venue-id &V.venues.id]}]}))))))
+ :condition [:= $checkins.venue-id &V.venues.id]}]})))))))
+
+(deftest ^:parallel all-implicitly-joined-table-ids-test-4
(testing "Works with breakouts"
(is (= (lib.tu.macros/$ids nil #{$$venues})
(lib/all-implicitly-joined-table-ids
@@ -210,7 +230,9 @@
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
:breakout [[:field $venues.name {:source-field %checkins.venue-id}]]
- :aggregation [[:count]]}))))))
+ :aggregation [[:count]]})))))))
+
+(deftest ^:parallel all-implicitly-joined-table-ids-test-5
(testing "Works with filters"
(is (= (lib.tu.macros/$ids nil #{$$venues})
(lib/all-implicitly-joined-table-ids
@@ -218,7 +240,9 @@
meta/metadata-provider
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
- :filter [:= [:field $venues.name {:source-field %checkins.venue-id}] "Bird's Nest"]}))))))
+ :filter [:= [:field $venues.name {:source-field %checkins.venue-id}] "Bird's Nest"]})))))))
+
+(deftest ^:parallel all-implicitly-joined-table-ids-test-6
(testing "Works with aggregations"
(is (= (lib.tu.macros/$ids nil #{$$venues})
(lib/all-implicitly-joined-table-ids
@@ -226,7 +250,9 @@
meta/metadata-provider
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
- :aggregation [[:sum [:field $venues.price {:source-field %checkins.venue-id}]]]}))))))
+ :aggregation [[:sum [:field $venues.price {:source-field %checkins.venue-id}]]]})))))))
+
+(deftest ^:parallel all-implicitly-joined-table-ids-test-7
(testing "Works with order-by"
(is (= (lib.tu.macros/$ids nil #{$$venues})
(lib/all-implicitly-joined-table-ids
@@ -234,7 +260,9 @@
meta/metadata-provider
(lib.tu.macros/mbql-query nil
{:source-table $$checkins
- :order-by [[:asc [:field $venues.name {:source-field %checkins.venue-id}]]]}))))))
+ :order-by [[:asc [:field $venues.name {:source-field %checkins.venue-id}]]]})))))))
+
+(deftest ^:parallel all-implicitly-joined-table-ids-test-8
(testing "Works in join conditions"
(is (= (lib.tu.macros/$ids nil #{$$categories})
(lib/all-implicitly-joined-table-ids
diff --git a/test/metabase/mcp/api_test.clj b/test/metabase/mcp/api_test.clj
index 4e6e64eb4d5..f8f486492b5 100644
--- a/test/metabase/mcp/api_test.clj
+++ b/test/metabase/mcp/api_test.clj
@@ -740,7 +740,9 @@
(mcp-request (jsonrpc-request "tools/call"
{:name "visualize_query"
:arguments {:query "ZW5jb2RlZA=="}})
- {"mcp-session-id" session-id})))))
+ {"mcp-session-id" session-id}))))))
+
+(deftest tools-call-visualize-query-test-2
(testing "visualize_query resolves a stored handle"
(let [user-id (mt/user->id :crowberto)
[session-id _] (initialize!)
@@ -751,7 +753,9 @@
(mcp-request (jsonrpc-request "tools/call"
{:name "visualize_query"
:arguments {:query_handle handle}})
- {"mcp-session-id" session-id})))))
+ {"mcp-session-id" session-id}))))))
+
+(deftest tools-call-visualize-query-test-3
(testing "visualize_query includes the prompt stored with a construct_query handle"
;; Mirrors master's assertion that the user's original prompt round-trips through the
;; construct→store→visualize flow so the iframe can include it when submitting
@@ -774,7 +778,9 @@
(is (=? {:status 200
:body {:result {:structuredContent {:query string?
:prompt "show 5 orders"}}}}
- response))))
+ response)))))
+
+(deftest tools-call-visualize-query-test-4
(testing "visualize_query asks for an argument when neither query nor handle is provided"
(let [[session-id _] (initialize!)]
(is (=? {:status 200
@@ -783,7 +789,9 @@
(mcp-request (jsonrpc-request "tools/call"
{:name "visualize_query"
:arguments {}})
- {"mcp-session-id" session-id})))))
+ {"mcp-session-id" session-id}))))))
+
+(deftest tools-call-visualize-query-test-5
(testing "visualize_query returns 'handle not found' when query_handle is unknown"
(let [[session-id _] (initialize!)]
(is (=? {:status 200
diff --git a/test/metabase/metabot/agent/messages_test.clj b/test/metabase/metabot/agent/messages_test.clj
index 0995ac1d925..632df9e62a0 100644
--- a/test/metabase/metabot/agent/messages_test.clj
+++ b/test/metabase/metabot/agent/messages_test.clj
@@ -81,21 +81,27 @@
(is (=? [{:role :user :content #(str/ends-with? % "Hello")}]
(messages/build-message-history
{}
- (memory/initialize [{:role :user :content "Hello"}] {})))))
+ (memory/initialize [{:role :user :content "Hello"}] {}))))))
+
+(deftest ^:parallel build-message-history-test-2
(testing "includes assistant text from input"
(is (=? [{:role :user :content "Hello"}
{:type :text :text "Hi there"}]
(messages/build-message-history
{}
(memory/initialize [{:role :user :content "Hello"}
- {:role :assistant :content "Hi there"}] {})))))
+ {:role :assistant :content "Hi there"}] {}))))))
+
+(deftest ^:parallel build-message-history-test-3
(testing "includes step parts from memory"
(is (=? [{:role :user :content #(str/ends-with? % "Hello")}
{:type :text :text "Response text"}]
(messages/build-message-history
{}
(-> (memory/initialize [{:role :user :content "Hello"}] {})
- (memory/add-step [{:type :text :text "Response text"}]))))))
+ (memory/add-step [{:type :text :text "Response text"}])))))))
+
+(deftest ^:parallel build-message-history-test-4
(testing "includes tool calls from steps"
(is (=? [{:role :user :content #(str/ends-with? % "Search for revenue")}
{:type :tool-input :id "t1" :function "search" :arguments {:query "revenue"}}]
@@ -105,7 +111,9 @@
(memory/add-step [{:type :tool-input
:id "t1"
:function "search"
- :arguments {:query "revenue"}}]))))))
+ :arguments {:query "revenue"}}])))))))
+
+(deftest ^:parallel build-message-history-test-5
(testing "includes tool results from steps"
(is (=? [{:role :user :content #(str/ends-with? % "Search")}
{:type :tool-input :id "t1" :function "search"}
@@ -114,7 +122,9 @@
{}
(-> (memory/initialize [{:role :user :content "Search"}] {})
(memory/add-step [{:type :tool-input :id "t1" :function "search" :arguments {:query "test"}}])
- (memory/add-step [{:type :tool-output :id "t1" :result {:data []}}]))))))
+ (memory/add-step [{:type :tool-output :id "t1" :result {:data []}}])))))))
+
+(deftest ^:parallel build-message-history-test-6
(testing "handles multiple iterations"
(is (=? [{:role :user :content #(str/ends-with? % "Hello")}
{:type :tool-input :id "t1"}
@@ -125,7 +135,9 @@
(-> (memory/initialize [{:role :user :content "Hello"}] {})
(memory/add-step [{:type :tool-input :id "t1" :function "search" :arguments {}}])
(memory/add-step [{:type :tool-output :id "t1" :result {:data []}}])
- (memory/add-step [{:type :text :text "Found results"}]))))))
+ (memory/add-step [{:type :text :text "Found results"}])))))))
+
+(deftest ^:parallel build-message-history-test-7
(testing "filters out non-message parts from steps"
(is (=? [{:role :user :content #(str/ends-with? % "Hello")}
{:type :text :text "Response"}]
@@ -134,7 +146,9 @@
(-> (memory/initialize [{:role :user :content "Hello"}] {})
(memory/add-step [{:type :start :messageId "m1"}
{:type :text :text "Response"}
- {:type :usage :usage {:promptTokens 10}}]))))))
+ {:type :usage :usage {:promptTokens 10}}])))))))
+
+(deftest ^:parallel build-message-history-test-8
(testing "merges consecutive assistant messages from input history"
;; Frontend may send separate text and tool_calls messages
(is (=? [{:role :user :content "Hello"}
diff --git a/test/metabase/metabot/agent/prompts_test.clj b/test/metabase/metabot/agent/prompts_test.clj
index 7c9121fa4eb..1b04d62a7be 100644
--- a/test/metabase/metabot/agent/prompts_test.clj
+++ b/test/metabase/metabot/agent/prompts_test.clj
@@ -4,7 +4,7 @@
[clojure.test :refer :all]
[metabase.metabot.agent.prompts :as prompts]))
-(deftest load-system-prompt-template-test
+(deftest ^:parallel load-system-prompt-template-test
(testing "loads internal.selmer template"
(let [template (prompts/load-system-prompt-template "internal.selmer")]
(is (some? template))
@@ -20,14 +20,14 @@
(let [template (prompts/load-system-prompt-template "non-existent.selmer")]
(is (nil? template)))))
-(deftest construct-notebook-query-prompt-database-name-examples-test
+(deftest ^:parallel construct-notebook-query-prompt-database-name-examples-test
(let [prompt (prompts/load-tool-prompt-template "construct_notebook_query.md")]
(is (some? prompt))
(testing "examples use the exact sample database name, not the old abbreviated portable FK"
(is (str/includes? prompt "Sample Database"))
(is (not (re-find #"\[Sample\s*," prompt))))))
-(deftest load-dialect-instructions-test
+(deftest ^:parallel load-dialect-instructions-test
(testing "loads postgresql dialect"
(let [instructions (prompts/load-dialect-instructions "postgresql")]
(is (some? instructions))
@@ -45,7 +45,7 @@
(let [instructions (prompts/load-dialect-instructions nil)]
(is (nil? instructions)))))
-(deftest render-system-prompt-test
+(deftest ^:parallel render-system-prompt-test
(testing "renders template with variables"
(let [template "Hello {{name}}, today is {{day}}"
context {:name "Metabot" :day "Monday"}
@@ -100,13 +100,13 @@
(let [template (prompts/get-cached-system-prompt "internal.selmer")]
(is (some? template)))))
-(deftest extract-tool-instructions-test
+(deftest ^:parallel extract-tool-instructions-test
(testing "finds correct instructions"
(is (=? [{:tool_name "read_resource"
:instructions #(str/includes? % "you have access to a unified interface")}]
(prompts/extract-tool-instructions {"read_resource" identity})))))
-(deftest build-system-message-content-test
+(deftest ^:parallel build-system-message-content-test
(testing "builds complete system message"
(let [profile {:prompt-template "embedding-next.selmer"}
context {:current_time "2024-01-15 14:30:00"
@@ -118,7 +118,9 @@
(is (string? content))
(is (> (count content) 100))
(is (re-find #"Metabot" content))
- (is (re-find #"2024-01-15 14:30:00" content))))
+ (is (re-find #"2024-01-15 14:30:00" content)))))
+
+(deftest ^:parallel build-system-message-content-test-2
(testing "includes dialect instructions when dialect specified"
(let [profile {:prompt-template "embedding-next.selmer"}
context {:current_time "2024-01-15 14:30:00"
@@ -128,14 +130,18 @@
(is (some? content))
;; Note: The embedding template might not reference dialect instructions,
;; but they should be available in the template context
- (is (string? content))))
+ (is (string? content)))))
+
+(deftest ^:parallel build-system-message-content-test-3
(testing "falls back to default message if template not found"
(let [profile {:prompt-template "non-existent.selmer"}
context {}
tools {}
content (prompts/build-system-message-content profile context tools)]
(is (some? content))
- (is (= "You are Metabot, a data analysis assistant for Metabase." content))))
+ (is (= "You are Metabot, a data analysis assistant for Metabase." content)))))
+
+(deftest ^:parallel build-system-message-content-test-4
(testing "uses default template name if not specified"
(let [profile {}
context {:current_time "2024-01-15 14:30:00"}
@@ -143,7 +149,9 @@
content (prompts/build-system-message-content profile context tools)]
(is (some? content))
(is (string? content))
- (is (> (count content) 1000))))
+ (is (> (count content) 1000)))))
+
+(deftest ^:parallel build-system-message-content-test-5
(testing "renders transform codegen template with literal model syntax"
(let [profile {:prompt-template "transform-codegen.selmer"}
context {:current_time "2024-01-15 14:30:00"
@@ -157,7 +165,9 @@
(is (str/includes? content "{{snippet: Snippet Name}}"))
(is (str/includes? content "{{snippet: recent orders}}"))
(is (not (str/includes? content "{%raw%}")))
- (is (not (str/includes? content "{% safe %}")))))
+ (is (not (str/includes? content "{% safe %}"))))))
+
+(deftest ^:parallel build-system-message-content-test-6
(testing "current user info is not in system message (moved to message injection)"
(let [profile {:prompt-template "internal.selmer"}
context {:current_time "2024-01-15 14:30:00"
diff --git a/test/metabase/metabot/agent/user_context_test.clj b/test/metabase/metabot/agent/user_context_test.clj
index 2b8cdd21613..4fda13fe125 100644
--- a/test/metabase/metabot/agent/user_context_test.clj
+++ b/test/metabase/metabot/agent/user_context_test.clj
@@ -10,7 +10,7 @@
[metabase.metabot.tools.shared.llm-shape :as llm-shape]
[metabase.test :as mt]))
-(deftest format-current-time-test
+(deftest ^:parallel format-current-time-test
(testing "formats time from context with timezone"
(let [context {:current_time_with_timezone "2024-01-15T14:30:00-05:00"}
result (user-context/format-current-time context)]
@@ -34,7 +34,7 @@
(is (string?
(user-context/format-current-time {:current_time_with_timezone "invalid"})))))
-(deftest extract-sql-dialect-test
+(deftest ^:parallel extract-sql-dialect-test
(testing "extracts sql_engine from explicit type: native context"
(let [context {:user_is_viewing [{:type "native"
:sql_engine "PostgreSQL"}]}
@@ -61,7 +61,7 @@
result (user-context/extract-sql-dialect context)]
(is (nil? result)))))
-(deftest format-viewing-context-test
+(deftest ^:parallel format-viewing-context-test
(let [mp meta/metadata-provider]
(testing "formats adhoc notebook (MBQL) query context"
(is (=? (re-pattern
@@ -139,7 +139,7 @@
(is (some? result))
(is (re-find #"no active buffers" result))))))
-(deftest format-viewing-context-test-2
+(deftest ^:parallel format-viewing-context-test-2a
(testing "formats table entity"
(let [context {:user_is_viewing [{:type "table"
:id 123
@@ -149,7 +149,9 @@
(is (some? result))
(is (re-find #"table" result))
(is (re-find #"users" result))
- (is (re-find #"User accounts" result))))
+ (is (re-find #"User accounts" result)))))
+
+(deftest ^:parallel format-viewing-context-test-2b
(testing "formats model entity"
(let [context {:user_is_viewing [{:type "model"
:id 456
@@ -158,7 +160,9 @@
result (user-context/format-viewing-context context)]
(is (some? result))
(is (re-find #"model" result))
- (is (re-find #"Revenue Model" result))))
+ (is (re-find #"Revenue Model" result)))))
+
+(deftest ^:parallel format-viewing-context-test-2c
(testing "formats question entity"
(let [context {:user_is_viewing [{:type "question"
:id 789
@@ -166,7 +170,9 @@
result (user-context/format-viewing-context context)]
(is (some? result))
(is (re-find #"question" result))
- (is (re-find #"Top Customers" result))))
+ (is (re-find #"Top Customers" result)))))
+
+(deftest ^:parallel format-viewing-context-test-2d
(testing "formats metric entity"
(let [context {:user_is_viewing [{:type "metric"
:id 111
@@ -174,7 +180,9 @@
result (user-context/format-viewing-context context)]
(is (some? result))
(is (re-find #"metric" result))
- (is (re-find #"Total Revenue" result))))
+ (is (re-find #"Total Revenue" result)))))
+
+(deftest ^:parallel format-viewing-context-test-2e
(testing "formats dashboard entity"
(let [context {:user_is_viewing [{:type "dashboard"
:id 222
@@ -182,7 +190,9 @@
result (user-context/format-viewing-context context)]
(is (some? result))
(is (re-find #"dashboard" result))
- (is (re-find #"Executive Dashboard" result))))
+ (is (re-find #"Executive Dashboard" result)))))
+
+(deftest ^:parallel format-viewing-context-test-2f
(testing "handles keyword types in viewing context"
(let [context {:user_is_viewing [{:type :table
:id 321
@@ -190,11 +200,15 @@
result (user-context/format-viewing-context context)]
(is (some? result))
(is (re-find #"table" result))
- (is (re-find #"orders" result))))
+ (is (re-find #"orders" result)))))
+
+(deftest ^:parallel format-viewing-context-test-2g
(testing "handles empty viewing context"
(let [context {}
result (user-context/format-viewing-context context)]
- (is (= "" result))))
+ (is (= "" result)))))
+
+(deftest ^:parallel format-viewing-context-test-2h
(testing "handles multiple viewing items"
(let [context {:user_is_viewing [{:type "table" :id 1 :name "users"}
{:type "question" :id 2 :name "Top Users"}]}
@@ -203,7 +217,7 @@
(is (re-find #"users" result))
(is (re-find #"Top Users" result)))))
-(deftest format-recent-views-test
+(deftest ^:parallel format-recent-views-test
(testing "formats recent views"
(let [context {:user_recently_viewed [{:type "question"
:id 123
@@ -232,7 +246,7 @@
result (user-context/format-recent-views context)]
(is (= "" result)))))
-(deftest format-current-user-info-test
+(deftest ^:parallel format-current-user-info-test
(testing "formats the current user as XML"
(mt/with-dynamic-fn-redefs [entity-details/get-current-user (fn [_]
{:structured-output {:id 1
@@ -249,7 +263,7 @@
{:output "current user not found"})]
(is (nil? (user-context/format-current-user-info {}))))))
-(deftest enrich-context-for-template-test
+(deftest ^:parallel enrich-context-for-template-test
(testing "enriches context with all template variables (legacy type: native)"
(mt/with-dynamic-fn-redefs [user-context/format-current-user-info (constantly "<user>Jane Doe</user>")]
(let [context {:current_time_with_timezone "2024-01-15T14:30:00-05:00"
@@ -299,7 +313,7 @@
(is (= "" (:viewing_context result)))
(is (= "" (:recent_views result))))))
-(deftest format-entity-includes-measures-and-segments-test
+(deftest ^:parallel format-entity-includes-measures-and-segments-test
(testing "table viewing context includes measures and segments when present"
(mt/with-dynamic-fn-redefs [entity-details/get-table-details
(fn [{:keys [table-id with-measures? with-segments?]}]
@@ -326,7 +340,9 @@
(is (re-find #"Measures \(Pre-defined Aggregation Formulas\)" result))
(is (re-find #"Average Order Value" result))
(is (re-find #"Segments \(Pre-defined Filter Conditions\)" result))
- (is (re-find #"Q4 Orders" result)))))
+ (is (re-find #"Q4 Orders" result))))))
+
+(deftest ^:parallel format-entity-includes-measures-and-segments-test-2
(testing "model viewing context includes measures and segments when present"
(mt/with-dynamic-fn-redefs [entity-details/get-table-details
(fn [{:keys [model-id with-measures? with-segments?]}]
@@ -350,7 +366,9 @@
(is (re-find #"Measures" result))
(is (re-find #"Total Revenue" result))
(is (re-find #"Segments" result))
- (is (re-find #"Enterprise Accounts" result)))))
+ (is (re-find #"Enterprise Accounts" result))))))
+
+(deftest ^:parallel format-entity-includes-measures-and-segments-test-3
(testing "table viewing context omits measures/segments sections when none exist"
(mt/with-dynamic-fn-redefs [entity-details/get-table-details
(fn [{:keys [entity-id]}]
@@ -368,7 +386,7 @@
(is (not (re-find #"Measures" result)))
(is (not (re-find #"Segments" result)))))))
-(deftest format-entity-fetches-details-from-db-test
+(deftest ^:parallel format-entity-fetches-details-from-db-test
(testing "question with only type+id fetches name and description from DB"
(mt/with-test-user :rasta
(mt/with-temp [:model/Card {card-id :id} {:name "Retention Cohorts"
@@ -427,7 +445,7 @@
(is (str/includes? result "1111")
"Formatting result should contain database id")))
-(deftest format-transform-source-mbql-renders-repr-json-test
+(deftest ^:parallel format-transform-source-mbql-renders-repr-json-test
(testing "transform sources with a structured MBQL `:query` are rendered as a portable repr JSON code block, not pprint'd pMBQL"
(mt/test-driver :h2
(mt/with-current-user (mt/user->id :crowberto)
@@ -445,7 +463,7 @@
(is (not (re-find #"lib/metadata" text))
"the metadata-provider handle never leaks to the LLM-facing payload"))))))
-(deftest format-transform-source-native-renders-repr-json-test
+(deftest ^:parallel format-transform-source-native-renders-repr-json-test
(testing "native transform sources also go through the repr export so template-tags stay portable"
(mt/test-driver :h2
(mt/with-current-user (mt/user->id :crowberto)
diff --git a/test/metabase/metabot/persistence_test.clj b/test/metabase/metabot/persistence_test.clj
index eba5c46d632..63218e9cbfb 100644
--- a/test/metabase/metabot/persistence_test.clj
+++ b/test/metabase/metabot/persistence_test.clj
@@ -11,7 +11,7 @@
(use-fixtures :once (fixtures/initialize :test-users))
-(deftest message->chat-messages-test
+(deftest ^:parallel message->chat-messages-test
(testing "user text block"
(let [result (metabot-persistence/message->chat-messages
{:role :user
@@ -19,27 +19,35 @@
(is (= 1 (count result)))
(is (= {:role "user" :type "text" :message "hello"}
(select-keys (first result) [:role :type :message])))
- (is (string? (:id (first result))))))
+ (is (string? (:id (first result)))))))
+
+(deftest ^:parallel message->chat-messages-test-2
(testing "assistant standard text block preserves block id"
(let [result (metabot-persistence/message->chat-messages
{:role :assistant
:data [{:type "text" :text "hi there" :id "block-1"}]})]
(is (= [{:id "block-1" :role "agent" :type "text" :message "hi there"}]
- (mapv #(select-keys % [:id :role :type :message]) result)))))
+ (mapv #(select-keys % [:id :role :type :message]) result))))))
+
+(deftest ^:parallel message->chat-messages-test-3
(testing "assistant standard text block without id gets a generated one"
(let [result (metabot-persistence/message->chat-messages
{:role :assistant
:data [{:type "text" :text "no id"}]})]
(is (= 1 (count result)))
(is (string? (:id (first result))))
- (is (= "no id" (:message (first result))))))
+ (is (= "no id" (:message (first result)))))))
+
+(deftest ^:parallel message->chat-messages-test-4
(testing "assistant slack-format text block"
(let [result (metabot-persistence/message->chat-messages
{:role :assistant
:data [{:role "assistant" :_type "TEXT" :content "from slack"}]})]
(is (= 1 (count result)))
(is (= {:role "agent" :type "text" :message "from slack"}
- (select-keys (first result) [:role :type :message])))))
+ (select-keys (first result) [:role :type :message]))))))
+
+(deftest ^:parallel message->chat-messages-test-5
(testing "tool-input merged with matching tool-output"
(let [result (metabot-persistence/message->chat-messages
{:role :assistant
@@ -55,14 +63,18 @@
:is_error false}
(select-keys (first result) [:id :role :type :name :status :is_error])))
(is (= {:query "foo"} (json/decode+kw (:args (first result)))))
- (is (= {:rows [1 2 3]} (json/decode+kw (:result (first result)))))))
+ (is (= {:rows [1 2 3]} (json/decode+kw (:result (first result))))))))
+
+(deftest ^:parallel message->chat-messages-test-6
(testing "tool-output flagged as error"
(let [result (metabot-persistence/message->chat-messages
{:role :assistant
:data [{:type "tool-input" :id "call-2" :function "boom" :arguments {}}
{:type "tool-output" :id "call-2" :error "exploded"}]})]
(is (true? (:is_error (first result))))
- (is (nil? (:result (first result))))))
+ (is (nil? (:result (first result)))))))
+
+(deftest ^:parallel message->chat-messages-test-7
(testing "tool-input without matching output is left as-is"
(let [result (metabot-persistence/message->chat-messages
{:role :assistant
@@ -70,13 +82,17 @@
(is (= 1 (count result)))
(is (= "tool_call" (:type (first result))))
(is (not (contains? (first result) :result)))
- (is (not (contains? (first result) :is_error)))))
+ (is (not (contains? (first result) :is_error))))))
+
+(deftest ^:parallel message->chat-messages-test-8
(testing "unknown block types are dropped"
(is (= []
(metabot-persistence/message->chat-messages
{:role :assistant
:data [{:type "data-foo" :payload {}}
- {:type "mystery"}]}))))
+ {:type "mystery"}]})))))
+
+(deftest ^:parallel message->chat-messages-test-9
(testing "data parts are converted to data_part chat messages"
(let [blocks [{:type "data" :data-type "navigate_to" :data "/question/1"}
{:type "data" :data-type "todo_list" :version 1 :data [{:id "t1"}]}
@@ -84,11 +100,13 @@
(is (=? [{:role "agent" :type "data_part" :part {:type "navigate_to" :version 1 :value "/question/1"}}
{:role "agent" :type "data_part" :part {:type "todo_list" :version 1 :value [{:id "t1"}]}}
{:role "agent" :type "data_part" :part {:type "code_edit" :version 1 :value {:buffer_id "b" :value "v"}}}]
- (metabot-persistence/message->chat-messages {:role :assistant :data blocks})))))
+ (metabot-persistence/message->chat-messages {:role :assistant :data blocks}))))))
+
+(deftest ^:parallel message->chat-messages-test-10
(testing "nil :data yields no messages"
(is (= [] (metabot-persistence/message->chat-messages {:role :user :data nil})))))
-(deftest messages->chat-messages-flattens-across-messages-test
+(deftest ^:parallel messages->chat-messages-flattens-across-messages-test
(let [result (metabot-persistence/messages->chat-messages
[{:role :user :data [{:role "user" :content "hi"}]}
{:role :assistant :data [{:type "text" :text "hello!" :id "b1"}
@@ -122,7 +140,7 @@
(is (= channel-id (:slack_channel_id conversation)))
(is (= thread-ts (:slack_thread_ts conversation)))))))
-(deftest combine-text-parts-xf-merges-consecutive-text-test
+(deftest ^:parallel combine-text-parts-xf-merges-consecutive-text-test
(testing "consecutive :text parts coalesce; non-text parts split runs"
(let [parts [{:type :text :text "Hello, "}
{:type :text :text "world"}
diff --git a/test/metabase/metabot/self_test.clj b/test/metabase/metabot/self_test.clj
index a4e4d6bb194..0119c9ad5fd 100644
--- a/test/metabase/metabot/self_test.clj
+++ b/test/metabase/metabot/self_test.clj
@@ -190,7 +190,9 @@
{:type :text :id "text-1" :text "Hello world"}])
result (into [] (self.core/tool-executor-xf test-util/TOOLS) chunks)]
(is (= chunks result)
- "Non-tool chunks should pass through unchanged")))
+ "Non-tool chunks should pass through unchanged"))))
+
+(deftest ^:parallel tool-executor-xf-test-2
(testing "tool-executor-xf executes tool calls and appends results"
(let [chunks (test-util/parts->aisdk-chunks
[{:type :start :id "msg-123"}
@@ -206,7 +208,9 @@
:toolCallId "call-1"
:toolName "get-time"
:result string?}
- tool-result)))))
+ tool-result))))))
+
+(deftest ^:parallel tool-executor-xf-test-3
(testing "tool-executor-xf handles multiple concurrent tool calls"
(let [chunks (test-util/parts->aisdk-chunks
[{:type :start :id "msg-456"}
@@ -219,7 +223,9 @@
(is (every? #(= :tool-output-available (:type %)) tool-results)
"Last two chunks should be tool outputs")
(is (= #{"call-1" "call-2"}
- (set (map :toolCallId tool-results)))))))
+ (set (map :toolCallId tool-results))))))))
+
+(deftest ^:parallel tool-executor-xf-test-4
(testing "tool-executor-xf handles tools returning reducibles"
(let [llm-id "wut-1"
input "Little bits and pieces"
@@ -235,7 +241,9 @@
(is (= {:type :text
:id llm-id
:text input}
- (last (into [] (self.core/aisdk-xf) result))))))
+ (last (into [] (self.core/aisdk-xf) result)))))))
+
+(deftest ^:parallel tool-executor-xf-test-5
(testing "tool-executor-xf handles tool execution errors gracefully"
(let [chunks (test-util/parts->aisdk-chunks
[{:type :start :id "msg-789"}
@@ -247,7 +255,9 @@
:toolName "get-time"
:error {:message string?
:type string?}}
- (last result)))))
+ (last result))))))
+
+(deftest ^:parallel tool-executor-xf-test-6
(testing "tool-executor-xf handles nil arguments for no-arg tools"
(let [chunks (test-util/parts->aisdk-chunks
[{:type :start :id "msg-nil"}
@@ -257,7 +267,9 @@
:toolCallId "call-nil"
:toolName "no-arg"
:result {:output "ok"}}
- (last result)))))
+ (last result))))))
+
+(deftest ^:parallel tool-executor-xf-test-7
(testing "tool-executor-xf ignores unknown tool names"
(let [chunks (test-util/parts->aisdk-chunks
[{:type :start :id "msg-789"}
diff --git a/test/metabase/metabot/tools/document_test.clj b/test/metabase/metabot/tools/document_test.clj
index 6e256846f37..073d0474631 100644
--- a/test/metabase/metabot/tools/document_test.clj
+++ b/test/metabase/metabot/tools/document_test.clj
@@ -68,7 +68,9 @@
:type "native"
:native {:query "SELECT * FROM test"
:template-tags {}}}
- (:dataset_query structured))))))
+ (:dataset_query structured)))))))
+
+(deftest document-construct-sql-chart-tool-test-2
(testing "returns instructions when SQL validation fails"
(mt/with-dynamic-fn-redefs [create-sql-query-tools/create-sql-query
(fn [_]
@@ -86,7 +88,9 @@
(is (nil? (:final-response? result)))
(is (nil? (:structured-output result)))
(is (re-find #"SQL chart draft generation failed" (:output result)))
- (is (re-find #"syntax error near FROM" (:output result))))))
+ (is (re-find #"syntax error near FROM" (:output result)))))))
+
+(deftest document-construct-sql-chart-tool-test-3
(testing "returns instructions when query processor rejects generated SQL"
(mt/with-dynamic-fn-redefs [create-sql-query-tools/create-sql-query
(fn [_]
diff --git a/test/metabase/metabot/tools/search_test.clj b/test/metabase/metabot/tools/search_test.clj
index b0ad946f01d..70ff10d75a8 100644
--- a/test/metabase/metabot/tools/search_test.clj
+++ b/test/metabase/metabot/tools/search_test.clj
@@ -14,7 +14,7 @@
[metabase.util :as u]
[toucan2.core :as t2]))
-(deftest reciprocal-rank-fusion-test
+(deftest ^:parallel reciprocal-rank-fusion-test
(testing "Basic RRF with single list"
(let [single-list [[{:id 1 :model "card" :name "Card 1"}
{:id 2 :model "dashboard" :name "Dashboard 1"}
@@ -23,7 +23,9 @@
(is (= 3 (count result)))
(is (= 1 (-> result first :id)))
(is (= 2 (-> result second :id)))
- (is (= 3 (-> result last :id)))))
+ (is (= 3 (-> result last :id))))))
+
+(deftest ^:parallel reciprocal-rank-fusion-test-2
(testing "RRF with multiple lists - no overlap"
(let [list1 [{:id 1 :model "card" :name "Card 1"}
{:id 2 :model "dashboard" :name "Dashboard 1"}]
@@ -31,7 +33,9 @@
{:id 4 :model "metric" :name "Metric 1"}]
result (#'search/reciprocal-rank-fusion [list1 list2])]
(is (= 4 (count result)))
- (is (every? #(contains? #{1 2 3 4} (:id %)) result))))
+ (is (every? #(contains? #{1 2 3 4} (:id %)) result)))))
+
+(deftest ^:parallel reciprocal-rank-fusion-test-3
(testing "RRF with overlapping results - should boost common items"
(let [list1 [{:id 1 :model "card" :name "Revenue Report"}
{:id 2 :model "dashboard" :name "Sales Dashboard"}
@@ -44,7 +48,9 @@
;; Items appearing in both lists should rank higher
(let [top-two-ids (set (map :id (take 2 result)))]
(is (contains? top-two-ids 1))
- (is (contains? top-two-ids 2)))))
+ (is (contains? top-two-ids 2))))))
+
+(deftest ^:parallel reciprocal-rank-fusion-test-4
(testing "RRF with identical items at different positions"
(let [list1 [{:id 1 :model "card" :name "First"}
{:id 2 :model "dashboard" :name "Second"}
@@ -58,16 +64,22 @@
result (#'search/reciprocal-rank-fusion [list1 list2 list3])]
(is (= 3 (count result)))
;; Item 2 appears first in list3, second in list1 and list2, so should rank highest
- (is (= 2 (-> result first :id)))))
+ (is (= 2 (-> result first :id))))))
+
+(deftest ^:parallel reciprocal-rank-fusion-test-5
(testing "RRF with empty lists"
(let [list1 []
list2 [{:id 1 :model "card" :name "Card 1"}]
result (#'search/reciprocal-rank-fusion [list1 list2])]
(is (= 1 (count result)))
- (is (= 1 (-> result first :id)))))
+ (is (= 1 (-> result first :id))))))
+
+(deftest ^:parallel reciprocal-rank-fusion-test-6
(testing "RRF with all empty lists"
(let [result (#'search/reciprocal-rank-fusion [[] [] []])]
- (is (empty? result))))
+ (is (empty? result)))))
+
+(deftest ^:parallel reciprocal-rank-fusion-test-7
(testing "RRF score calculation correctness"
;; Test that the RRF formula 1/(k+r) where k=60 is correctly applied
(let [list1 [{:id 1 :model "card" :name "Rank 1"}] ; rank=1, score=1/61
@@ -81,7 +93,9 @@
;; Item 2 appears only at rank 1 in list2 (score=1/61 ≈ 0.0164)
;; So item 1 should rank higher than item 2
(is (= 1 (:id first-item)))
- (is (= 2 (:id second-item)))))
+ (is (= 2 (:id second-item))))))
+
+(deftest ^:parallel reciprocal-rank-fusion-test-8
(testing "RRF preserves item data"
(let [complex-item {:id 42
:model "dataset"
@@ -92,7 +106,9 @@
:extra_field "preserved"}
result (#'search/reciprocal-rank-fusion [[complex-item]])]
(is (= 1 (count result)))
- (is (= complex-item (first result)))))
+ (is (= complex-item (first result))))))
+
+(deftest ^:parallel reciprocal-rank-fusion-test-9
(testing "RRF with many lists"
(let [lists (for [i (range 5)]
[{:id (inc i) :model "card" :name (str "Card " (inc i))}
@@ -102,7 +118,7 @@
;; Item 99 appears in all 5 lists at position 2, so should rank very high
(is (= 99 (:id (first result)))))))
-(deftest postprocess-search-result-test
+(deftest ^:parallel postprocess-search-result-test
(testing "table result postprocessing"
(let [result {:model "table"
:id 1
@@ -122,7 +138,9 @@
:database_schema "public"
:updated_at "2024-01-01"
:created_at "2024-01-01"}]
- (is (= expected (#'search/postprocess-search-result result)))))
+ (is (= expected (#'search/postprocess-search-result result))))))
+
+(deftest ^:parallel postprocess-search-result-test-2
(testing "model (dataset) result postprocessing"
(let [result {:model "dataset"
:id 2
@@ -142,7 +160,9 @@
:collection {}
:updated_at "2024-01-02"
:created_at "2024-01-02"}]
- (is (= expected (#'search/postprocess-search-result result)))))
+ (is (= expected (#'search/postprocess-search-result result))))))
+
+(deftest ^:parallel postprocess-search-result-test-3
(testing "transform result postprocessing"
(let [result {:model "transform"
:id 3
@@ -158,7 +178,9 @@
:database_id 44
:updated_at "2024-01-03"
:created_at "2024-01-03"}]
- (is (= expected (#'search/postprocess-search-result result)))))
+ (is (= expected (#'search/postprocess-search-result result))))))
+
+(deftest ^:parallel postprocess-search-result-test-4
(testing "dashboard result postprocessing"
(let [result {:model "dashboard"
:id 3
@@ -176,7 +198,9 @@
:collection {:id 10 :name "Finance" :authority_level "official"}
:updated_at "2024-01-03"
:created_at "2024-01-03"}]
- (is (= expected (#'search/postprocess-search-result result)))))
+ (is (= expected (#'search/postprocess-search-result result))))))
+
+(deftest ^:parallel postprocess-search-result-test-5
(testing "question (card) result postprocessing with moderated_status"
(let [result {:model "card"
:id 4
@@ -195,7 +219,9 @@
:collection {:id 11 :name "Analytics" :authority_level nil}
:updated_at "2024-01-04"
:created_at "2024-01-04"}]
- (is (= expected (#'search/postprocess-search-result result)))))
+ (is (= expected (#'search/postprocess-search-result result))))))
+
+(deftest ^:parallel postprocess-search-result-test-6
(testing "metric result postprocessing"
(let [result {:model "metric"
:id 5
@@ -213,7 +239,9 @@
:collection {}
:updated_at "2024-01-05"
:created_at "2024-01-05"}]
- (is (= expected (#'search/postprocess-search-result result)))))
+ (is (= expected (#'search/postprocess-search-result result))))))
+
+(deftest ^:parallel postprocess-search-result-test-7
(testing "database result postprocessing"
(let [result {:model "database"
:id 6
diff --git a/test/metabase/metabot/tools/shared/llm_shape_test.clj b/test/metabase/metabot/tools/shared/llm_shape_test.clj
index d3894488bb8..eb251ce0d8f 100644
--- a/test/metabase/metabot/tools/shared/llm_shape_test.clj
+++ b/test/metabase/metabot/tools/shared/llm_shape_test.clj
@@ -4,7 +4,7 @@
[clojure.test :refer :all]
[metabase.metabot.tools.shared.llm-shape :as llm-shape]))
-(deftest escape-xml-test
+(deftest ^:parallel escape-xml-test
(testing "escape-xml handles special characters"
(is (= "&amp;" (#'llm-shape/escape-xml "&")))
(is (= "&lt;" (#'llm-shape/escape-xml "<")))
@@ -15,7 +15,7 @@
(testing "escape-xml handles nil"
(is (nil? (#'llm-shape/escape-xml nil)))))
-(deftest field->xml-test
+(deftest ^:parallel field->xml-test
(testing "formats field with all attributes matching Python format"
;; for field data format see `metabase.metabot.tools.util/->result-column`
(let [field {:field_id "f1"
@@ -57,7 +57,7 @@
xml (llm-shape/field->xml field)]
(is (not (str/includes? xml "fk_target_fully_qualified_name"))))))
-(deftest collection->xml-test
+(deftest ^:parallel collection->xml-test
(testing "formats collection with name"
(let [collection {:name "Finance" :description "Finance reports" :authority_level "official"}
xml (llm-shape/collection->xml collection)]
@@ -70,7 +70,7 @@
xml (llm-shape/collection->xml collection)]
(is (str/includes? xml "name=\"Our analytics\"")))))
-(deftest metric->xml-test
+(deftest ^:parallel metric->xml-test
(testing "formats metric with all attributes matching Python"
(let [metric {:id 42
:name "Total Revenue"
@@ -98,7 +98,7 @@
(is (str/includes? xml "is_verified=\"false\""))
(is (not (str/includes? xml "### Dimensions"))))))
-(deftest measure->xml-test
+(deftest ^:parallel measure->xml-test
(testing "formats measure with all attributes"
(let [;; The new contract: `:definition` is a portable aggregation clause vector,
;; produced by `convert-measure-or-segment` via `repr.resolve/export-query`.
@@ -146,7 +146,7 @@
xml (llm-shape/measure->xml measure)]
(is (str/includes? xml "display_name=\"avg_price\"")))))
-(deftest segment->xml-test
+(deftest ^:parallel segment->xml-test
(testing "formats segment with all attributes"
(let [;; The new contract: `:definition` is a portable filter clause vector;
;; `:portable-entity-id` is the NanoID the agent pastes into `["segment", {}, "<pid>"]`.
@@ -193,7 +193,7 @@
xml (llm-shape/segment->xml segment)]
(is (str/includes? xml "display_name=\"q4_orders\"")))))
-(deftest table->xml-test
+(deftest ^:parallel table->xml-test
(testing "formats table with all attributes matching Python"
(let [table {:id 10
:name "users"
@@ -245,7 +245,7 @@
(is (not (str/includes? xml "### Measures")))
(is (not (str/includes? xml "### Segments"))))))
-(deftest model->xml-test
+(deftest ^:parallel model->xml-test
(testing "formats model with all attributes matching Python"
(let [model {:id 5
:name "Sales Model"
@@ -268,7 +268,9 @@
(is (str/includes? xml "The following fields are available in this model"))
(is (str/includes? xml "metabase://model/5/fields/{field_id}"))
;; Python closes with </model>
- (is (str/ends-with? (str/trim xml) "</model>"))))
+ (is (str/ends-with? (str/trim xml) "</model>")))))
+
+(deftest ^:parallel model->xml-test-2
(testing "includes measures and segments when present"
(let [model {:id 5
:name "Sales Model"
@@ -286,21 +288,29 @@
(is (str/includes? xml "Total Net Revenue"))
(is (str/includes? xml "### Segments (Pre-defined Filter Conditions)"))
(is (str/includes? xml "<segment id=\"1\""))
- (is (str/includes? xml "New Customers"))))
+ (is (str/includes? xml "New Customers")))))
+
+(deftest ^:parallel model->xml-test-3
(testing "omits measures and segments sections when empty"
(let [model {:id 5 :name "Empty Model" :database_id 1 :database_engine "postgres"}
xml (llm-shape/model->xml model)]
(is (not (str/includes? xml "### Measures")))
- (is (not (str/includes? xml "### Segments")))))
+ (is (not (str/includes? xml "### Segments"))))))
+
+(deftest ^:parallel model->xml-test-4
(testing "includes portable_entity_id when present (for `source-card:` lookups)"
(let [model {:id 6 :name "Portable Model" :database_id 1 :database_engine "postgres"
:portable_entity_id "bw41Vx2d-9d7sOScnaKlf"}
xml (llm-shape/model->xml model)]
- (is (str/includes? xml "portable_entity_id=\"bw41Vx2d-9d7sOScnaKlf\""))))
+ (is (str/includes? xml "portable_entity_id=\"bw41Vx2d-9d7sOScnaKlf\"")))))
+
+(deftest ^:parallel model->xml-test-5
(testing "omits portable_entity_id when absent"
(let [model {:id 7 :name "No EID Model" :database_id 1 :database_engine "postgres"}
xml (llm-shape/model->xml model)]
- (is (not (str/includes? xml "portable_entity_id")))))
+ (is (not (str/includes? xml "portable_entity_id"))))))
+
+(deftest ^:parallel model->xml-test-6
(testing "renders the saved query body as a <query> block when :query_json is provided"
(let [query-json {"lib/type" "mbql/query"
"database" "Sample"
@@ -312,7 +322,9 @@
(is (str/includes? xml "<query>"))
(is (str/includes? xml "```json"))
(is (str/includes? xml "\"lib/type\""))
- (is (str/includes? xml "</query>"))))
+ (is (str/includes? xml "</query>")))))
+
+(deftest ^:parallel model->xml-test-7
(testing "omits the <query> block when :query_json is missing or blank"
(let [xml-missing (llm-shape/model->xml {:id 9 :name "M" :database_id 1 :database_engine "postgres"})
xml-empty (llm-shape/model->xml {:id 10 :name "M" :database_id 1 :database_engine "postgres"
@@ -320,7 +332,7 @@
(is (not (str/includes? xml-missing "<query>")))
(is (not (str/includes? xml-empty "<query>"))))))
-(deftest query->xml-test
+(deftest ^:parallel query->xml-test
(testing "formats query result matching Python"
(let [query {:query-type :sql
:query-id "q123"
@@ -344,7 +356,7 @@
(is (str/includes? xml "type=\"notebook\""))
(is (not (str/includes? xml "<query_results>"))))))
-(deftest chart->xml-test
+(deftest ^:parallel chart->xml-test
(testing "formats chart (simplified version)"
(let [chart {:chart-id "ch-abc-123"
:query-id "q1"
@@ -361,7 +373,7 @@
xml (llm-shape/chart->xml chart)]
(is (str/includes? xml "type=\"table\"")))))
-(deftest visualization->xml-test
+(deftest ^:parallel visualization->xml-test
(testing "formats visualization with queries"
(let [viz {:chart-id "v1"
:queries [{:query-type :sql :query-id "q1" :database_id 1 :query-content "SELECT 1"}]
@@ -373,7 +385,7 @@
(is (str/includes? xml "<query"))
(is (str/includes? xml "<visualization>")))))
-(deftest question->xml-test
+(deftest ^:parallel question->xml-test
(testing "formats question matching Python"
(let [question {:id 100
:name "Revenue Report"
@@ -426,7 +438,7 @@
(is (not (str/includes? xml-missing "<query>")))
(is (not (str/includes? xml-empty "<query>"))))))
-(deftest dashboard->xml-test
+(deftest ^:parallel dashboard->xml-test
(testing "formats dashboard matching Python"
(let [dashboard {:id 50
:name "Sales Dashboard"
@@ -447,7 +459,7 @@
(is (str/includes? xml "<text_card"))
(is (str/ends-with? (str/trim xml) "</dashboard>")))))
-(deftest user->xml-test
+(deftest ^:parallel user->xml-test
(testing "formats user matching Python"
(let [user {:id 1
:name "John Doe"
@@ -463,7 +475,7 @@
(is (str/includes? xml "| ARR | Annual Recurring Revenue |"))
(is (str/ends-with? (str/trim xml) "</user>")))))
-(deftest search-result->xml-test
+(deftest ^:parallel search-result->xml-test
(testing "formats search result with correct tag names"
(let [result {:id 100
:type :metric
@@ -478,7 +490,9 @@
(is (str/includes? xml "is_verified=\"true\""))
(is (str/includes? xml "Total revenue calculation"))
(is (str/includes? xml "Collection: Finance"))
- (is (str/ends-with? (str/trim xml) "</metric>"))))
+ (is (str/ends-with? (str/trim xml) "</metric>")))))
+
+(deftest ^:parallel search-result->xml-test-2
(testing "table search result includes database_id, database_engine, and fully_qualified_name"
(let [result {:id 133
:type "table"
@@ -492,7 +506,9 @@
(is (str/includes? xml "name=\"order\""))
(is (str/includes? xml "database_id=\"2\""))
(is (str/includes? xml "database_engine=\"postgres\""))
- (is (str/includes? xml "fully_qualified_name=\"shopify_data.order\""))))
+ (is (str/includes? xml "fully_qualified_name=\"shopify_data.order\"")))))
+
+(deftest ^:parallel search-result->xml-test-3
(testing "table search result without schema omits schema prefix in fqn"
(let [result {:id 10
:type "table"
@@ -501,7 +517,9 @@
:database_engine :h2}
xml (llm-shape/search-result->xml result)]
(is (str/includes? xml "fully_qualified_name=\"users\""))
- (is (str/includes? xml "database_engine=\"h2\""))))
+ (is (str/includes? xml "database_engine=\"h2\"")))))
+
+(deftest ^:parallel search-result->xml-test-4
(testing "model search result includes database_id, database_engine, and fully_qualified_name"
(let [result {:id 5
:type "model"
@@ -513,7 +531,9 @@
(is (str/starts-with? xml "<model"))
(is (str/includes? xml "database_id=\"1\""))
(is (str/includes? xml "database_engine=\"postgres\""))
- (is (str/includes? xml "fully_qualified_name=\"{#5}-sales-model\""))))
+ (is (str/includes? xml "fully_qualified_name=\"{#5}-sales-model\"")))))
+
+(deftest ^:parallel search-result->xml-test-5
(testing "question search result includes portable_entity_id attribute when present"
(let [result {:id 175
:type "question"
@@ -525,7 +545,9 @@
xml (llm-shape/search-result->xml result)]
(is (str/starts-with? xml "<question"))
(is (str/includes? xml "id=\"175\""))
- (is (str/includes? xml "portable_entity_id=\"dh9P5mz7vhpqYUPosLPqL\""))))
+ (is (str/includes? xml "portable_entity_id=\"dh9P5mz7vhpqYUPosLPqL\"")))))
+
+(deftest ^:parallel search-result->xml-test-6
(testing "model search result includes portable_entity_id attribute when present"
(let [result {:id 42
:type "model"
@@ -535,18 +557,24 @@
:database_engine "postgres"
:portable_entity_id "AbCdEfGhIjKlMnOpQrStU"}
xml (llm-shape/search-result->xml result)]
- (is (str/includes? xml "portable_entity_id=\"AbCdEfGhIjKlMnOpQrStU\""))))
+ (is (str/includes? xml "portable_entity_id=\"AbCdEfGhIjKlMnOpQrStU\"")))))
+
+(deftest ^:parallel search-result->xml-test-7
(testing "search result without portable_entity_id simply omits the attribute"
(let [result {:id 99 :type "question" :name "Legacy"
:verified false :database_id 1 :database_engine "h2"}
xml (llm-shape/search-result->xml result)]
- (is (not (str/includes? xml "portable_entity_id")))))
+ (is (not (str/includes? xml "portable_entity_id"))))))
+
+(deftest ^:parallel search-result->xml-test-8
(testing "table search result never carries portable_entity_id"
(let [result {:id 10 :type "table" :name "ORDERS"
:verified false :database_id 1 :database_engine "h2"
:database_schema "PUBLIC"}
xml (llm-shape/search-result->xml result)]
- (is (not (str/includes? xml "portable_entity_id")))))
+ (is (not (str/includes? xml "portable_entity_id"))))))
+
+(deftest ^:parallel search-result->xml-test-9
(testing "non-table/model search results omit table-specific attributes"
(let [result {:id 50
:type :dashboard
@@ -555,7 +583,9 @@
xml (llm-shape/search-result->xml result)]
(is (not (str/includes? xml "fully_qualified_name")))
(is (not (str/includes? xml "database_id")))
- (is (not (str/includes? xml "database_engine")))))
+ (is (not (str/includes? xml "database_engine"))))))
+
+(deftest ^:parallel search-result->xml-test-10
(testing "uses correct tag names for different types"
(is (str/starts-with? (llm-shape/search-result->xml {:id 1 :type :table :name "t"}) "<table"))
;; Model uses <metabase-model> tag
@@ -565,7 +595,7 @@
(is (str/starts-with? (llm-shape/search-result->xml {:id 1 :type :card :name "c"}) "<metabase_question"))
(is (str/starts-with? (llm-shape/search-result->xml {:id 1 :type :dataset :name "d"}) "<metabase-model"))))
-(deftest search-results->xml-test
+(deftest ^:parallel search-results->xml-test
(testing "formats multiple search results"
(let [results [{:id 1 :type :metric :name "Metric 1"}
{:id 2 :type :table :name "Table 1"}]
@@ -580,7 +610,7 @@
(is (str/includes? xml "<search-results>"))
(is (str/includes? xml "</search-results>")))))
-(deftest field-values-metadata->xml-test
+(deftest ^:parallel field-values-metadata->xml-test
(testing "formats field values with samples"
(let [metadata {:field_values ["US" "DE" "FR"]
:statistics {:sample_distinct_count 3
@@ -596,7 +626,7 @@
xml (llm-shape/field-values-metadata->xml metadata)]
(is (str/includes? xml "This field hasn't been sampled yet")))))
-(deftest field-metadata->xml-test
+(deftest ^:parallel field-metadata->xml-test
(testing "formats field metadata"
(let [metadata {:field_id "f1"
:value_metadata {:field_values ["A" "B"]}}
@@ -608,7 +638,7 @@
xml (llm-shape/field-metadata->xml metadata)]
(is (str/includes? xml "No metadata available to display")))))
-(deftest get-metadata-result->xml-test
+(deftest ^:parallel get-metadata-result->xml-test
(testing "formats metadata with metrics, tables, and models"
(let [result {:metrics [{:id 1 :name "M1" :description "Metric 1"}]
:tables [{:id 2 :name "T1" :database_id 1 :description "Table 1"}]
@@ -631,7 +661,7 @@
(is (str/includes? xml "<errors>"))
(is (str/includes? xml "Error 1")))))
-(deftest entity->xml-test
+(deftest ^:parallel entity->xml-test
(testing "dispatches to correct formatter based on type"
(is (str/starts-with? (llm-shape/entity->xml {:type :metric :id 1 :name "m"}) "<metric"))
(is (str/starts-with? (llm-shape/entity->xml {:type :table :id 1 :name "t" :database_id 1}) "<table"))
diff --git a/test/metabase/metabot/tools/todo_test.clj b/test/metabase/metabot/tools/todo_test.clj
index 110044cb35d..0b8c91c8d6e 100644
--- a/test/metabase/metabot/tools/todo_test.clj
+++ b/test/metabase/metabot/tools/todo_test.clj
@@ -3,7 +3,7 @@
[clojure.test :refer :all]
[metabase.metabot.tools.todo :as todo]))
-(deftest todo-write-test
+(deftest ^:parallel todo-write-test
(testing "todo-write validates and stores todos in memory"
(let [memory-atom (atom {:state {}})
todos [{:id "1" :content "First task" :status "pending" :priority "high"}
@@ -14,7 +14,9 @@
(is (contains? result :data-parts))
(is (contains? result :instructions))
;; Check memory was updated
- (is (= todos (get-in @memory-atom [:state :todos])))))
+ (is (= todos (get-in @memory-atom [:state :todos]))))))
+
+(deftest ^:parallel todo-write-test-2
(testing "todo-write returns data-parts with todo_list type"
(let [memory-atom (atom {:state {}})
todos [{:id "1" :content "Task" :status "pending" :priority "low"}]
@@ -23,41 +25,53 @@
(is (= :data (:type data-part)))
(is (= "todo_list" (:data-type data-part)))
(is (= 1 (:version data-part)))
- (is (= todos (:data data-part)))))
+ (is (= todos (:data data-part))))))
+
+(deftest ^:parallel todo-write-test-3
(testing "todo-write rejects invalid status"
(let [memory-atom (atom {:state {}})
todos [{:id "1" :content "Task" :status "invalid_status" :priority "high"}]]
(is (thrown-with-msg?
clojure.lang.ExceptionInfo
#"Invalid todo status"
- (todo/todo-write {:todos todos :memory-atom memory-atom})))))
+ (todo/todo-write {:todos todos :memory-atom memory-atom}))))))
+
+(deftest ^:parallel todo-write-test-4
(testing "todo-write rejects invalid priority"
(let [memory-atom (atom {:state {}})
todos [{:id "1" :content "Task" :status "pending" :priority "critical"}]]
(is (thrown-with-msg?
clojure.lang.ExceptionInfo
#"Invalid todo priority"
- (todo/todo-write {:todos todos :memory-atom memory-atom})))))
+ (todo/todo-write {:todos todos :memory-atom memory-atom}))))))
+
+(deftest ^:parallel todo-write-test-5
(testing "todo-write rejects missing id"
(let [memory-atom (atom {:state {}})
todos [{:content "Task" :status "pending" :priority "high"}]]
(is (thrown-with-msg?
clojure.lang.ExceptionInfo
#"missing required 'id' field"
- (todo/todo-write {:todos todos :memory-atom memory-atom})))))
+ (todo/todo-write {:todos todos :memory-atom memory-atom}))))))
+
+(deftest ^:parallel todo-write-test-6
(testing "todo-write rejects missing content"
(let [memory-atom (atom {:state {}})
todos [{:id "1" :status "pending" :priority "high"}]]
(is (thrown-with-msg?
clojure.lang.ExceptionInfo
#"missing required 'content' field"
- (todo/todo-write {:todos todos :memory-atom memory-atom})))))
+ (todo/todo-write {:todos todos :memory-atom memory-atom}))))))
+
+(deftest ^:parallel todo-write-test-7
(testing "todo-write accepts all valid statuses"
(let [memory-atom (atom {:state {}})]
(doseq [status ["pending" "in_progress" "completed" "cancelled"]]
(let [todos [{:id "1" :content "Task" :status status :priority "medium"}]
result (todo/todo-write {:todos todos :memory-atom memory-atom})]
- (is (some? (:structured-output result)))))))
+ (is (some? (:structured-output result))))))))
+
+(deftest ^:parallel todo-write-test-8
(testing "todo-write accepts all valid priorities"
(let [memory-atom (atom {:state {}})]
(doseq [priority ["high" "medium" "low"]]
@@ -65,7 +79,7 @@
result (todo/todo-write {:todos todos :memory-atom memory-atom})]
(is (some? (:structured-output result))))))))
-(deftest todo-read-test
+(deftest ^:parallel todo-read-test
(testing "todo-read returns empty list when no todos in memory"
(let [memory-atom (atom {:state {}})
result (todo/todo-read {:memory-atom memory-atom})]
diff --git a/test/metabase/metabot/tools/transforms/write_test.clj b/test/metabase/metabot/tools/transforms/write_test.clj
index 5a6f1ceed70..5d9b5582a29 100644
--- a/test/metabase/metabot/tools/transforms/write_test.clj
+++ b/test/metabase/metabot/tools/transforms/write_test.clj
@@ -7,7 +7,7 @@
;;; Edit Application Tests
-(deftest apply-edits-test
+(deftest ^:parallel apply-edits-test
(testing "replace mode replaces entire content"
(let [memory-atom (atom {:state {}})
result (transforms-write/write-transform-sql
@@ -18,7 +18,9 @@
:memory-atom memory-atom})]
(is (= "SELECT * FROM users"
(some-> (get-in result [:structured-output :transform :source :query])
- lib/raw-native-query)))))
+ lib/raw-native-query))))))
+
+(deftest ^:parallel apply-edits-test-2
(testing "edit mode with single edit"
(let [mp (mt/metadata-provider)
existing-transform {:id 1
@@ -33,7 +35,9 @@
:memory-atom memory-atom})]
(is (= "SELECT id FROM customers"
(some-> (get-in result [:structured-output :transform :source :query])
- lib/raw-native-query)))))
+ lib/raw-native-query))))))
+
+(deftest ^:parallel apply-edits-test-3
(testing "edit mode with multiple edits"
(let [mp (mt/metadata-provider)
existing-transform {:id 1
@@ -49,7 +53,9 @@
:memory-atom memory-atom})]
(is (= "SELECT col_x, col_y FROM table2"
(some-> (get-in result [:structured-output :transform :source :query])
- lib/raw-native-query)))))
+ lib/raw-native-query))))))
+
+(deftest ^:parallel apply-edits-test-4
(testing "edit mode fails when text not found"
(let [mp (mt/metadata-provider)
existing-transform {:id 1
@@ -64,7 +70,9 @@
:edit_action {:mode "edit"
:edits [{:old_string "nonexistent"
:new_string "replacement"}]}
- :memory-atom memory-atom})))))
+ :memory-atom memory-atom}))))))
+
+(deftest ^:parallel apply-edits-test-5
(testing "edit mode fails for ambiguous matches without replace_all"
(let [mp (mt/metadata-provider)
existing-transform {:id 1
@@ -79,7 +87,9 @@
:edit_action {:mode "edit"
:edits [{:old_string "foo"
:new_string "bar"}]}
- :memory-atom memory-atom})))))
+ :memory-atom memory-atom}))))))
+
+(deftest ^:parallel apply-edits-test-6
(testing "edit mode with replace_all replaces all occurrences"
(let [mp (mt/metadata-provider)
existing-transform {:id 1
@@ -99,7 +109,7 @@
;;; Transform Creation Tests
-(deftest create-fresh-transform-test
+(deftest ^:parallel create-fresh-transform-test
(testing "creates fresh SQL transform when no transform_id"
(let [memory-atom (atom {:state {}})
result (transforms-write/write-transform-sql
@@ -116,7 +126,7 @@
;;; Data Parts Tests
-(deftest data-parts-test
+(deftest ^:parallel data-parts-test
(testing "returns transform_suggestion data part"
(let [memory-atom (atom {:state {}})
result (transforms-write/write-transform-sql
@@ -133,7 +143,7 @@
;;; Memory Storage Tests
-(deftest memory-storage-test
+(deftest ^:parallel memory-storage-test
(testing "stores updated transform in memory when transform_id provided"
(let [mp (mt/metadata-provider)
existing-transform {:id 1 :name "Existing" :source {:query (lib/native-query mp "SELECT 1")}}
@@ -155,7 +165,7 @@
;;; Error Handling Tests
-(deftest error-handling-test
+(deftest ^:parallel error-handling-test
(testing "fails when transform_id not found"
(let [memory-atom (atom {:state {:transforms {}}})]
(is (thrown-with-msg?
diff --git a/test/metabase/metabot/util_test.clj b/test/metabase/metabot/util_test.clj
index 726d9f54379..eb2b6583916 100644
--- a/test/metabase/metabot/util_test.clj
+++ b/test/metabase/metabot/util_test.clj
@@ -28,7 +28,9 @@
(metabot.u/aisdk->messages "assistant"
(-> (io/resource "metabase/metabot/aisdkstream1.txt")
io/reader
- line-seq)))))
+ line-seq))))))
+
+(deftest ^:parallel aisdk-line-parse-test-2
(testing "We should be able to parse AI SDK streaming format to ai-service format 2"
(is (=? [{:role "assistant"
:_type :TOOL_CALL
@@ -65,7 +67,9 @@
(metabot.u/aisdk->messages "assistant"
(-> (io/resource "metabase/metabot/aisdkstream2.txt")
io/reader
- line-seq)))))
+ line-seq))))))
+
+(deftest ^:parallel aisdk-line-parse-test-3
(testing "We should be able to parse AI SDK streaming format with error messages 3"
(is (=? [{:role "assistant"
:_type :ERROR
@@ -76,7 +80,9 @@
(metabot.u/aisdk->messages "assistant"
(-> (io/resource "metabase/metabot/aisdkstream3.txt")
io/reader
- line-seq)))))
+ line-seq))))))
+
+(deftest ^:parallel aisdk-line-parse-test-4
(testing "We should be able to parse AI SDK streaming format with error messages 4"
(is (=? [{:role "assistant"
:_type :TEXT
diff --git a/test/metabase/models/serialization/resolve/mp_test.clj b/test/metabase/models/serialization/resolve/mp_test.clj
index cbd1a9606e4..bcf0a319f24 100644
--- a/test/metabase/models/serialization/resolve/mp_test.clj
+++ b/test/metabase/models/serialization/resolve/mp_test.clj
@@ -100,7 +100,7 @@
;;; import-table-fk
;;; ============================================================
-(deftest import-table-fk-test
+(deftest ^:parallel import-table-fk-test
(testing "happy path"
(let [r (resolve.mp/import-resolver mp-simple)]
(is (= 10 (resolve/import-table-fk r ["Sample" "PUBLIC" "ORDERS"])))
@@ -116,7 +116,7 @@
(is (= 30 (resolve/import-table-fk r ["DW" "RAW" "ORDERS"])))
(is (= 31 (resolve/import-table-fk r ["DW" "CLEAN" "ORDERS"]))))))
-(deftest import-table-fk-error-test
+(deftest ^:parallel import-table-fk-error-test
(testing "unknown table name → :unknown-table, agent-error?, 400, no info leak"
(let [r (resolve.mp/import-resolver mp-simple)]
(try
@@ -133,7 +133,9 @@
(is (nil? (:candidates d)))
(is (nil? (:available-schemas d))))
(testing "message points the LLM at entity_details for self-correction"
- (is (re-find #"entity_details" msg))))))))
+ (is (re-find #"entity_details" msg)))))))))
+
+(deftest ^:parallel import-table-fk-error-test-2
(testing "schema does not exist in DB → still :unknown-table, no schema enumeration"
;; Pre-S1 this returned :unknown-schema + the full schema list. Post-S1 we collapse to
;; :unknown-table with no schema enumeration so a sandboxed user can't enumerate
@@ -150,7 +152,9 @@
(is (nil? (:available-schemas d)))
(testing "message must not enumerate schemas"
(is (not (re-find #"PUBLIC" msg)))
- (is (not (re-find #"Available schemas" msg)))))))))
+ (is (not (re-find #"Available schemas" msg))))))))))
+
+(deftest ^:parallel import-table-fk-error-test-3
(testing "table exists in other schemas → :unknown-table, no cross-schema leak"
;; A sandboxed user with no perms on schema RAW must not learn that RAW.ORDERS exists
;; just by hallucinating CLEAN.ORDERS at the agent.
@@ -168,7 +172,9 @@
(is (= :unknown-table (:error d)))
(is (nil? (:candidates d)))
(testing "message must not name RAW.ORDERS as a candidate"
- (is (not (re-find #"RAW" msg)))))))))
+ (is (not (re-find #"RAW" msg))))))))))
+
+(deftest ^:parallel import-table-fk-error-test-4
(testing "database name mismatch"
(let [r (resolve.mp/import-resolver mp-simple)]
(try
@@ -178,7 +184,9 @@
(let [d (ex-data e)]
(is (= :unknown-table (:error d)))
(is (= "Sample" (:expected-db d)))
- (is (true? (:agent-error? d))))))))
+ (is (true? (:agent-error? d)))))))))
+
+(deftest ^:parallel import-table-fk-error-test-5
(testing "fuzzy substring suggestions are NOT surfaced (info-leak guard)"
;; Pre-S1 the resolver would surface `PUBLIC.ORDERS` as a "closest tables" candidate
;; for an `ORDER` hallucination. Post-S1 nothing is suggested.
@@ -199,7 +207,7 @@
;;; import-field-fk
;;; ============================================================
-(deftest import-field-fk-test
+(deftest ^:parallel import-field-fk-test
(testing "happy path"
(let [r (resolve.mp/import-resolver mp-simple)]
(is (= 100 (resolve/import-field-fk r ["Sample" "PUBLIC" "ORDERS" "ID"])))
@@ -215,7 +223,7 @@
(let [r (resolve.mp/import-resolver mp-nested)]
(is (= 401 (resolve/import-field-fk r ["Nested" "PUBLIC" "ORDERS" "META" "vendor"]))))))
-(deftest import-field-fk-error-test
+(deftest ^:parallel import-field-fk-error-test
(testing "unknown field"
(let [r (resolve.mp/import-resolver mp-simple)]
(try
@@ -238,7 +246,7 @@
(catch clojure.lang.ExceptionInfo e
(is (= :invalid-field-fk (:error (ex-data e)))))))))
-(deftest import-field-fk-no-fk-candidate-leak-test
+(deftest ^:parallel import-field-fk-no-fk-candidate-leak-test
(testing "an unknown field that lives on an FK-reachable table MUST NOT surface that table"
;; Pre-S1 the resolver helpfully suggested `[Sample PUBLIC PRODUCTS CATEGORY]` as a
;; candidate when the LLM asked for `[Sample PUBLIC ORDERS CATEGORY]`. That leaks the
@@ -271,7 +279,7 @@
;;; export-table-fk / export-field-fk
;;; ============================================================
-(deftest export-table-fk-test
+(deftest ^:parallel export-table-fk-test
(testing "happy path"
(let [r (resolve.mp/export-resolver mp-simple)]
(is (= ["Sample" "PUBLIC" "ORDERS"] (resolve/export-table-fk r 10)))
@@ -287,7 +295,7 @@
(catch clojure.lang.ExceptionInfo e
(is (= :unknown-table-id (:error (ex-data e)))))))))
-(deftest export-field-fk-test
+(deftest ^:parallel export-field-fk-test
(testing "happy path"
(let [r (resolve.mp/export-resolver mp-simple)]
(is (= ["Sample" "PUBLIC" "ORDERS" "TOTAL"] (resolve/export-field-fk r 101)))))
@@ -304,7 +312,7 @@
path ["Sample" "PUBLIC" "ORDERS" "PRODUCT_ID"]]
(is (= path (resolve/export-field-fk er (resolve/import-field-fk ir path)))))))
-(deftest export-database-and-card-fks-test
+(deftest ^:parallel export-database-and-card-fks-test
(let [r (resolve.mp/export-resolver mp-with-cards)]
(testing "database id exports to the provider's database name"
(is (= "Sample" (resolve/export-fk-keyed r 1 :model/Database :name)))
@@ -317,7 +325,7 @@
(is (nil? (resolve/export-fk r nil 'Card)))
(is (nil? (resolve/export-fk-keyed r nil :model/Database :name))))))
-(deftest export-mbql-with-mp-resolver-round-trip-shape-test
+(deftest ^:parallel export-mbql-with-mp-resolver-round-trip-shape-test
(testing "final numeric pMBQL exports back to portable DB/table/field/card references"
(let [r (resolve.mp/export-resolver mp-with-cards)
exported (resolve/export-mbql
@@ -346,7 +354,7 @@
;;; Not-yet-implemented methods
;;; ============================================================
-(deftest not-implemented-phase1-test
+(deftest ^:parallel not-implemented-phase1-test
(let [er (resolve.mp/export-resolver mp-simple)]
(testing "export-fk for non-(Card/Measure/Segment) models still throws :not-implemented-yet"
(try
@@ -365,7 +373,7 @@
;;; import-fk - Card by entity_id (step 11)
;;; ============================================================
-(deftest import-fk-card-happy-path-test
+(deftest ^:parallel import-fk-card-happy-path-test
(testing "resolves a saved card's entity_id to its numeric id when the card lives in the same database"
(mt/with-temp [:model/Card {card-id :id card-eid :entity_id}
{:database_id (mt/id)
@@ -378,7 +386,7 @@
(testing "also accepts keyword-qualified model name :model/Card"
(is (= card-id (resolve/import-fk ir card-eid :model/Card))))))))
-(deftest import-fk-card-nil-input-returns-nil-test
+(deftest ^:parallel import-fk-card-nil-input-returns-nil-test
(testing "nil entity_id returns nil (matches table/field FK contract)"
(let [ir (resolve.mp/import-resolver mp-simple)]
(is (nil? (resolve/import-fk ir nil 'Card))))))
@@ -397,7 +405,7 @@
(is (= :unknown-card (:error d)))
(is (= "nonexistent_entity_id1" (:entity-id d))))))))))
-(deftest import-fk-card-cross-database-test
+(deftest ^:parallel import-fk-card-cross-database-test
(testing "a card that belongs to a different database surfaces a clear :cross-database-card error"
(mt/with-temp [:model/Database {other-db-id :id} {:name "Other DB" :engine :h2}
:model/Card {_card-id :id card-eid :entity_id}
@@ -420,7 +428,7 @@
;;; import-fk / export-fk - Measure & Segment by entity_id
;;; ============================================================
-(deftest import-fk-measure-happy-path-test
+(deftest ^:parallel import-fk-measure-happy-path-test
(testing "resolves a measure's entity_id to its numeric id when the measure's table is in the same database"
(mt/with-temp [:model/Measure {measure-id :id measure-eid :entity_id}
{:name "Test Measure"
@@ -435,7 +443,7 @@
(is (= measure-id (resolve/import-fk ir measure-eid 'Measure)))
(is (= measure-id (resolve/import-fk ir measure-eid :model/Measure)))))))
-(deftest import-fk-segment-happy-path-test
+(deftest ^:parallel import-fk-segment-happy-path-test
(testing "resolves a segment's entity_id to its numeric id when the segment's table is in the same database"
(let [mp (lib-be/application-database-metadata-provider (mt/id))
;; Look up the field id via lib metadata rather than `(mt/id :orders :total)` —
@@ -485,7 +493,7 @@
(is (true? (:agent-error? d)))
(is (= :unknown-segment (:error d))))))))))
-(deftest export-fk-measure-happy-path-test
+(deftest ^:parallel export-fk-measure-happy-path-test
(testing "exports a measure's numeric id back to its portable entity_id"
(mt/with-temp [:model/Measure {measure-id :id measure-eid :entity_id}
{:name "Round-trip Measure"
@@ -500,7 +508,7 @@
(is (= measure-eid (resolve/export-fk er measure-id 'Measure)))
(is (= measure-eid (resolve/export-fk er measure-id :model/Measure)))))))
-(deftest export-fk-segment-happy-path-test
+(deftest ^:parallel export-fk-segment-happy-path-test
(testing "exports a segment's numeric id back to its portable entity_id"
(let [mp (lib-be/application-database-metadata-provider (mt/id))
orders-id (mt/id :orders)
@@ -521,7 +529,7 @@
(is (= segment-eid (resolve/export-fk er segment-id 'Segment)))
(is (= segment-eid (resolve/export-fk er segment-id :model/Segment))))))))
-(deftest import-fk-non-supported-models-still-not-implemented-test
+(deftest ^:parallel import-fk-non-supported-models-still-not-implemented-test
(testing "models we haven't wired up still throw :not-implemented-yet"
(let [ir (resolve.mp/import-resolver mp-simple)]
;; Card, Measure, Segment are wired up — see their happy-path tests below.
@@ -554,7 +562,7 @@
{:id 300 :name "ID" :table-id 30 :base-type :type/Integer}
{:id 301 :name "NAME" :table-id 30 :base-type :type/Text}]}))
-(deftest outbound-fks-from-table-happy-path-test
+(deftest ^:parallel outbound-fks-from-table-happy-path-test
(testing "returns one entry per outbound FK, with target-table-id resolved"
(let [edges (resolve.mp/outbound-fks-from-table mp-fks-3 10)]
(is (= 2 (count edges)))
@@ -563,12 +571,12 @@
(is (every? :target-field-id edges))
(is (every? :source-field edges)))))
-(deftest outbound-fks-from-table-no-fks-test
+(deftest ^:parallel outbound-fks-from-table-no-fks-test
(testing "table with no outbound FKs returns empty seq"
(is (= [] (resolve.mp/outbound-fks-from-table mp-fks-3 20)))
(is (= [] (resolve.mp/outbound-fks-from-table mp-fks-3 30)))))
-(deftest outbound-fks-from-table-simple-mp-test
+(deftest ^:parallel outbound-fks-from-table-simple-mp-test
(testing "works on the existing simple MP too (no FKs configured)"
(is (= [] (resolve.mp/outbound-fks-from-table mp-simple 10)))))
@@ -590,14 +598,14 @@
(measure-by-id [_ _measure-id] nil)
(segment-by-id [_ _segment-id] nil)))
-(deftest import-fk-card-via-custom-content-store-happy-path-test
+(deftest ^:parallel import-fk-card-via-custom-content-store-happy-path-test
(testing "a custom ContentStore lets the resolver work without an app DB"
(let [card-eid "abcdefghijabcdefghij1"
store (map-content-store {card-eid {:id 4242 :database_id 1}})
ir (resolve.mp/import-resolver mp-simple store)]
(is (= 4242 (resolve/import-fk ir card-eid 'Card))))))
-(deftest import-fk-card-via-custom-content-store-unknown-test
+(deftest ^:parallel import-fk-card-via-custom-content-store-unknown-test
(testing "unknown entity_id from a custom store still surfaces :unknown-card"
(let [ir (resolve.mp/import-resolver mp-simple (map-content-store {}))]
(try
@@ -608,7 +616,7 @@
(is (true? (:agent-error? d)))
(is (= :unknown-card (:error d)))))))))
-(deftest import-fk-card-via-custom-content-store-cross-database-test
+(deftest ^:parallel import-fk-card-via-custom-content-store-cross-database-test
(testing "cross-DB check fires regardless of where the card came from"
(let [card-eid "abcdefghijabcdefghij2"
;; mp-simple's database is id=1; serve a card pinned to a different db.
diff --git a/test/metabase/parameters/custom_values_test.clj b/test/metabase/parameters/custom_values_test.clj
index 3e49bb333de..995826b1138 100644
--- a/test/metabase/parameters/custom_values_test.clj
+++ b/test/metabase/parameters/custom_values_test.clj
@@ -518,7 +518,7 @@
card
[:field {:lib/uuid "00000000-0000-0000-0000-000000000000"} (mt/id :products :category)]))))))))
-(deftest pk-of-fk-pk-field-ids-test
+(deftest ^:parallel pk-of-fk-pk-field-ids-test
(testing "single group"
(testing "with PK"
(is (= (mt/id :products :id)
@@ -548,7 +548,9 @@
(is (= (mt/id :products :id)
(custom-values/pk-of-fk-pk-field-ids [(mt/id :orders :product_id)
(mt/id :orders :product_id)
- (mt/id :orders :product_id)])))))
+ (mt/id :orders :product_id)]))))))
+
+(deftest ^:parallel pk-of-fk-pk-field-ids-test-2
(testing "two groups"
(testing "both with PKs"
(is (nil? (custom-values/pk-of-fk-pk-field-ids [(mt/id :orders :product_id)
@@ -564,7 +566,9 @@
(testing "none with PK"
(is (nil? (custom-values/pk-of-fk-pk-field-ids [(mt/id :orders :product_id)
(mt/id :reviews :product_id)
- (mt/id :orders :user_id)])))))
+ (mt/id :orders :user_id)]))))))
+
+(deftest ^:parallel pk-of-fk-pk-field-ids-test-3
(testing "single group with PK plus other field"
(is (nil? (custom-values/pk-of-fk-pk-field-ids #{(mt/id :orders :product_id)
(mt/id :reviews :product_id)
@@ -577,7 +581,9 @@
(is (nil? (custom-values/pk-of-fk-pk-field-ids #{(mt/id :orders :product_id)
(mt/id :reviews :product_id)
(mt/id :products :id)
- -1}))))
+ -1})))))
+
+(deftest ^:parallel pk-of-fk-pk-field-ids-test-4
(testing "single group without PK plus other field"
(is (nil? (custom-values/pk-of-fk-pk-field-ids [(mt/id :orders :product_id)
(mt/id :reviews :product_id)
@@ -587,8 +593,12 @@
Integer/MAX_VALUE})))
(is (nil? (custom-values/pk-of-fk-pk-field-ids #{(mt/id :orders :product_id)
(mt/id :reviews :product_id)
- -1}))))
+ -1})))))
+
+(deftest ^:parallel pk-of-fk-pk-field-ids-test-5
(testing "just a PK"
- (is (nil? (custom-values/pk-of-fk-pk-field-ids [(mt/id :products :id)]))))
+ (is (nil? (custom-values/pk-of-fk-pk-field-ids [(mt/id :products :id)])))))
+
+(deftest ^:parallel pk-of-fk-pk-field-ids-test-6
(testing "just a non-key"
(is (nil? (custom-values/pk-of-fk-pk-field-ids [(mt/id :people :name)])))))
diff --git a/test/metabase/query_processor/pivot/postprocess_test.clj b/test/metabase/query_processor/pivot/postprocess_test.clj
index 226d55a14db..2ff97a83ef8 100644
--- a/test/metabase/query_processor/pivot/postprocess_test.clj
+++ b/test/metabase/query_processor/pivot/postprocess_test.clj
@@ -3,7 +3,7 @@
[clojure.test :refer :all]
[metabase.query-processor.pivot.postprocess :as pivot.postprocess]))
-(deftest build-top-headers-test
+(deftest ^:parallel build-top-headers-test
(testing "builds top headers with single level hierarchy"
(let [top-header-items [{:depth 0 :value "A" :span 2}
{:depth 0 :value "B" :span 1}]
@@ -12,7 +12,9 @@
display-name-for-col (fn [idx] (condp = idx 0 "Row"))
result (#'pivot.postprocess/build-top-headers top-header-items left-header-items row-indexes display-name-for-col)]
(is (= [["Row" "A" "A" "B"]]
- result))))
+ result)))))
+
+(deftest ^:parallel build-top-headers-test-2
(testing "builds top headers with multi-level hierarchy"
(let [top-header-items [{:depth 0 :value "A" :span 2}
{:depth 1 :value "X" :span 1}
@@ -26,7 +28,9 @@
result (#'pivot.postprocess/build-top-headers top-header-items left-header-items row-indexes display-name-for-col)]
(is (= [[nil nil "A" "A" "B"]
["Row1" "Row2" "X" "Y" "Z"]]
- result))))
+ result)))))
+
+(deftest ^:parallel build-top-headers-test-3
(testing "handles the case where the max depth of the left-header-items tree is less than the count of row-indexes (#58340)"
(let [top-header-items [{:depth 0 :value "A" :span 2}
{:depth 1 :value "X" :span 1}
@@ -41,7 +45,9 @@
;; are collapsed and thus are omitted from the export
(is (= [[nil "A" "A" "B"]
["Row1" "X" "Y" "Z"]]
- result))))
+ result)))))
+
+(deftest ^:parallel build-top-headers-test-4
(testing "handles empty top header items without error"
(let [top-header-items []
left-header-items [{:depth 0 :value "Row1" :span 1 :offset 0 :maxDepthBelow 0}]
@@ -51,7 +57,7 @@
(is (= [["Row"]]
result)))))
-(deftest build-left-headers-test
+(deftest ^:parallel build-left-headers-test
(testing "builds left headers with single level hierarchy"
(let [left-header-items [{:depth 0 :value "A" :span 1 :offset 0}
{:depth 0 :value "B" :span 1 :offset 1}]
@@ -76,7 +82,7 @@
(is (= []
result)))))
-(deftest build-full-pivot-test
+(deftest ^:parallel build-full-pivot-test
(testing "builds full pivot table correctly"
(let [get-row-section (fn [col-idx row-idx]
(case [col-idx row-idx]
@@ -93,7 +99,9 @@
(is (= [["" "Col X" "Col Y"]
["Row A" "100" "300"]
["Row B" "200" "400"]]
- result))))
+ result)))))
+
+(deftest ^:parallel build-full-pivot-test-2
(testing "handles multiple measures per column"
(let [get-row-section (fn [col-idx row-idx]
(case [col-idx row-idx]
@@ -110,7 +118,9 @@
(is (= [["" "Col X" "Col X" "Col Y" "Col Y"]
["Row A" "100" "101" "300" "301"]
["Row B" "200" "201" "400" "401"]]
- result))))
+ result)))))
+
+(deftest ^:parallel build-full-pivot-test-3
(testing "handles empty left headers without error"
(let [get-row-section (fn [col-idx row-idx]
(case [col-idx row-idx]
@@ -122,7 +132,9 @@
result (#'pivot.postprocess/build-full-pivot get-row-section left-headers top-headers measure-count)]
(is (= [["" "Col X"]
["100"]]
- result))))
+ result)))))
+
+(deftest ^:parallel build-full-pivot-test-4
(testing "handles no values in row sections without error"
(let [get-row-section (constantly [])
left-headers [["Row A"]]
@@ -131,7 +143,9 @@
result (#'pivot.postprocess/build-full-pivot get-row-section left-headers top-headers measure-count)]
(is (= [["" "Col X"]
["Row A"]]
- result))))
+ result)))))
+
+(deftest ^:parallel build-full-pivot-test-5
(testing "handles zero measure-count with no error"
(let [get-row-section (constantly [])
left-headers []
diff --git a/test/metabase/query_processor/streaming/xlsx_test.clj b/test/metabase/query_processor/streaming/xlsx_test.clj
index 8673f99b78e..7e9417aab40 100644
--- a/test/metabase/query_processor/streaming/xlsx_test.clj
+++ b/test/metabase/query_processor/streaming/xlsx_test.clj
@@ -482,7 +482,7 @@
[[#t "2020-03-28T10:12:06.681"]]
:parse-fn parse-format-strings)))))))
-(deftest column-order-test
+(deftest ^:parallel column-order-test
(testing "Column titles are ordered correctly in the output"
(is (= ["Col1" "Col2"]
(first (xlsx-export [{:id 0, :name "Col1"} {:id 1, :name "Col2"}] {} []))))
@@ -499,7 +499,7 @@
{:output-order [1]}
[["a" "b"] ["c" "d"]]))))))
-(deftest column-title-test
+(deftest ^:parallel column-title-test
(testing "::mb.viz/column-title precedence over :display_name, which takes precendence over :name"
(is (= ["Display name"]
(first (xlsx-export [{:id 0, :display_name "Display name", :name "Name"}] {} []))))
@@ -511,7 +511,9 @@
(is (= ["Column title"]
(first (xlsx-export [{:display_name "Display name", :name "Name"}]
{::mb.viz/column-settings {{::mb.viz/column-name "Name"} {::mb.viz/column-title "Column title"}}}
- [])))))
+ []))))))
+
+(deftest ^:parallel column-title-test-2
(testing "Currency is included in column title if necessary"
;; Dollar symbol is included by default if semantic type of column derives from :type/Currency
(is (= ["Col ($)"]
@@ -568,7 +570,9 @@
{::mb.viz/currency "USD",
::mb.viz/currency-style "code",
::mb.viz/currency-in-header false}}}
- [])))))
+ []))))))
+
+(deftest ^:parallel column-title-test-3
(testing "If a col is remapped to a foreign key field, the title is taken from the viz settings for its fk_field_id (#18573)"
(is (= ["Correct title"]
(first (xlsx-export [{:id 0, :fk_field_id 1, :remapped_from "FIELD_1" :field_ref [:field 0]}]
@@ -576,14 +580,14 @@
{::mb.viz/field-id 1} {::mb.viz/column-title "Correct title"}}}
[]))))))
-(deftest scale-test
+(deftest ^:parallel scale-test
(testing "scale is applied to data prior to export"
(is (= [2.0]
(second (xlsx-export [{:id 0, :name "Col"}]
{::mb.viz/column-settings {{::mb.viz/column-name "Col"} {::mb.viz/scale 2}}}
[[1.0]]))))))
-(deftest misc-data-test
+(deftest ^:parallel misc-data-test
(testing "nil values"
(is (= [nil]
(second (xlsx-export [{:id 0, :name "Col"}] {} [[nil]])))))
@@ -652,8 +656,8 @@
(is (= [:DIV0]
(second (xlsx-export [{:id 0, :name "Col"}] {} [[##-Inf]]))))))
-(deftest geographic-coordinates-test
- (testing "Geograpic coordinates are correctly transformed"
+(deftest ^:parallel geographic-coordinates-test
+ (testing "Geographic coordinates are correctly transformed"
(is (= ["12.34560000° E"
"12.34560000° W"
"12.34560000° N"
@@ -708,7 +712,7 @@
(doseq [col-width widths]
(is (not= default-width col-width)))))
-(deftest auto-sizing-test
+(deftest ^:parallel auto-sizing-test
(testing "Columns in export are autosized to fit their content"
(xlsx-export [{:id 0, :name "Col1"} {:id 1, :name "Col2"}]
{}
diff --git a/test/metabase/revisions/impl/dashboard_test.clj b/test/metabase/revisions/impl/dashboard_test.clj
index 08b0f86d392..b855d9685ea 100644
--- a/test/metabase/revisions/impl/dashboard_test.clj
+++ b/test/metabase/revisions/impl/dashboard_test.clj
@@ -489,7 +489,9 @@
(revert-to-previous-revision! :model/Dashboard dashboard-id 2)
(is (=? [{:id tab-1-id :name "Tab 1" :position 0}
{:id tab-2-id :name "Tab 2" :position 1}]
- (t2/select :model/DashboardTab :dashboard_id dashboard-id {:order-by [[:position :asc]]}))))))
+ (t2/select :model/DashboardTab :dashboard_id dashboard-id {:order-by [[:position :asc]]})))))))
+
+(deftest revert-dashboard-with-tabs-basic-test-2
(testing "revert renaming tabs"
(mt/with-temp [:model/Dashboard {dashboard-id :id} {:name "A dashboard"}]
;; 0. create a dashboard
@@ -513,7 +515,9 @@
(revert-to-previous-revision! :model/Dashboard dashboard-id 2)
(is (=? [{:id tab-1-id :name "Tab 1" :position 0}
{:id tab-2-id :name "Tab 2" :position 1}]
- (t2/select :model/DashboardTab :dashboard_id dashboard-id {:order-by [[:position :asc]]}))))))
+ (t2/select :model/DashboardTab :dashboard_id dashboard-id {:order-by [[:position :asc]]})))))))
+
+(deftest revert-dashboard-with-tabs-basic-test-3
(testing "revert deleting tabs"
(mt/with-temp [:model/Dashboard {dashboard-id :id} {:name "A dashboard"}]
;; 0. create a dashboard
diff --git a/test/metabase/secrets/models/secret_test.clj b/test/metabase/secrets/models/secret_test.clj
index 0140b484d25..cbee3eb08c7 100644
--- a/test/metabase/secrets/models/secret_test.clj
+++ b/test/metabase/secrets/models/secret_test.clj
@@ -53,24 +53,30 @@
(encryption-test/with-secret-key (resolve 'encryption-test/secret)
(check-secret)))))
-(deftest get-secret-string-test
+(deftest ^:parallel get-secret-string-test
(testing "get-secret-string from value only"
(is (= "titok"
- (secret/value-as-string :secret-test-driver {:keystore-value "titok"} "keystore"))))
+ (secret/value-as-string :secret-test-driver {:keystore-value "titok"} "keystore")))))
+
+(deftest ^:parallel get-secret-string-test-2
(testing "get-secret-string from value only from the database"
(mt/with-temp [:model/Secret {id :id} {:name "private-key"
:kind ::secret/pem-cert
:value "titok"
:creator_id (mt/user->id :crowberto)}]
(is (= "titok"
- (secret/value-as-string :secret-test-driver {:keystore-id id} "keystore")))))
+ (secret/value-as-string :secret-test-driver {:keystore-id id} "keystore"))))))
+
+(deftest ^:parallel get-secret-string-test-3
(testing "get-secret-string from value only from the database ignore protected-password **MetabasePass**"
(mt/with-temp [:model/Secret {id :id} {:name "private-key"
:kind ::secret/pem-cert
:value "titok"
:creator_id (mt/user->id :crowberto)}]
(is (= "titok"
- (secret/value-as-string :secret-test-driver {:keystore-id id :keystore-value secret/protected-password} "keystore")))))
+ (secret/value-as-string :secret-test-driver {:keystore-id id :keystore-value secret/protected-password} "keystore"))))))
+
+(deftest ^:parallel get-secret-string-test-4
(testing "get-secret-string from uploaded value"
(mt/with-temp [:model/Secret {id :id} {:name "private-key"
:kind ::secret/pem-cert
@@ -90,7 +96,9 @@
:keystore-options "uploaded"}
"keystore"))
"psszt!"
- (mt/bytes->base64-data-uri (.getBytes "psszt!" "UTF-8"))))))
+ (mt/bytes->base64-data-uri (.getBytes "psszt!" "UTF-8")))))))
+
+(deftest ^:parallel get-secret-string-test-5
(testing "get-secret-string from local file"
(mt/with-temp-file [file-db "-1-key.pem"
file-value "-2-key.pem"]
diff --git a/test/metabase/server/lib/etag_cache_test.clj b/test/metabase/server/lib/etag_cache_test.clj
index 1d9506b8cd5..8520ed3f044 100644
--- a/test/metabase/server/lib/etag_cache_test.clj
+++ b/test/metabase/server/lib/etag_cache_test.clj
@@ -13,7 +13,7 @@
:headers headers
:body "dummy js"}))
-(deftest with-etag-returns-304-when-etag-matches
+(deftest ^:parallel with-etag-returns-304-when-etag-matches
(testing "Exact strong ETag match returns 304 with only ETag header added"
(let [etag (format "\"%s\"" config/mb-version-hash)
resp (lib.etag-cache/with-etag (base-response) {:headers {"if-none-match" etag}} {})]
@@ -37,7 +37,7 @@
:headers {"ETag" (format "\"%s\"" config/mb-version-hash)}}
resp)))))
-(deftest with-etag-returns-200-and-adds-etag-when-no-match
+(deftest ^:parallel with-etag-returns-200-and-adds-etag-when-no-match
(testing "ETag does not match -> 200; adds ETag, preserves existing headers; no Cache-Control/Content-Type"
(let [resp (lib.etag-cache/with-etag
(base-response {"X-Foo" "bar"})
@@ -59,7 +59,7 @@
(is (nil? (get-in resp [:headers "Cache-Control"])))
(is (nil? (get-in resp [:headers "Content-Type"]))))))
-(deftest with-etag-returns-304-on-wildcard
+(deftest ^:parallel with-etag-returns-304-on-wildcard
(testing "If-None-Match: * (or with whitespace) returns 304 and only adds ETag"
(doseq [if-none-match-value ["*" " * " "* " " *"]]
(let [resp (lib.etag-cache/with-etag
@@ -73,7 +73,7 @@
(is (nil? (get-in resp [:headers "Cache-Control"])))
(is (nil? (get-in resp [:headers "Content-Type"])))))))
-(deftest with-etag-weak-returns-304-when-etag-matches
+(deftest ^:parallel with-etag-weak-returns-304-when-etag-matches
(testing "Strong ETag match returns 304 with weak ETag in response"
(let [etag (format "\"%s\"" config/mb-version-hash)
weak-etag (format "W/\"%s\"" config/mb-version-hash)
@@ -96,7 +96,7 @@
:headers {"ETag" (format "W/\"%s\"" config/mb-version-hash)}}
resp)))))
-(deftest with-etag-weak-returns-200-and-adds-weak-etag-when-no-match
+(deftest ^:parallel with-etag-weak-returns-200-and-adds-weak-etag-when-no-match
(testing "ETag does not match -> 200; adds weak ETag, preserves existing headers"
(let [resp (lib.etag-cache/with-etag
(base-response {"X-Foo" "bar"})
@@ -114,7 +114,7 @@
:headers {"ETag" (format "W/\"%s\"" config/mb-version-hash)}}
resp)))))
-(deftest with-etag-weak-returns-304-on-wildcard
+(deftest ^:parallel with-etag-weak-returns-304-on-wildcard
(testing "If-None-Match: * returns 304 with weak ETag in response"
(doseq [if-none-match-value ["*" " * "]]
(let [resp (lib.etag-cache/with-etag
@@ -126,7 +126,7 @@
:headers {"ETag" (format "W/\"%s\"" config/mb-version-hash)}}
resp))))))
-(deftest with-etag-304-carries-over-rfc-9110-headers
+(deftest ^:parallel with-etag-304-carries-over-rfc-9110-headers
(testing "304 echoes Vary, Cache-Control, Content-Location, and Expires from original response"
(let [original-headers {"Vary" "Accept-Encoding"
"Cache-Control" "max-age=31536000"
@@ -144,7 +144,9 @@
"Content-Location" "/static/app/main.js"
"Expires" "Thu, 16 Apr 2026 12:00:00 GMT"
"ETag" etag}}
- resp))))
+ resp)))))
+
+(deftest ^:parallel with-etag-304-carries-over-rfc-9110-headers-2
(testing "304 does NOT carry over non-cacheable headers like Content-Type or X-Custom"
(let [original-headers {"Content-Type" "application/javascript"
"X-Custom" "secret"
@@ -158,7 +160,9 @@
:headers {"Vary" "Accept-Encoding"}}
resp))
(is (nil? (get-in resp [:headers "Content-Type"])))
- (is (nil? (get-in resp [:headers "X-Custom"])))))
+ (is (nil? (get-in resp [:headers "X-Custom"]))))))
+
+(deftest ^:parallel with-etag-304-carries-over-rfc-9110-headers-3
(testing "304 with weak ETag also carries over cacheable headers"
(let [original-headers {"Vary" "Accept-Encoding" "Cache-Control" "no-cache"}
etag (format "\"%s\"" config/mb-version-hash)
@@ -170,7 +174,9 @@
:headers {"Vary" "Accept-Encoding"
"Cache-Control" "no-cache"
"ETag" (format "W/\"%s\"" config/mb-version-hash)}}
- resp))))
+ resp)))))
+
+(deftest ^:parallel with-etag-304-carries-over-rfc-9110-headers-4
(testing "304 carries over headers regardless of case in original response"
(let [original-headers {"vary" "Accept-Encoding"
"cache-control" "max-age=600"
diff --git a/test/metabase/server/middleware/security_test.clj b/test/metabase/server/middleware/security_test.clj
index 474074b9c40..892f830545c 100644
--- a/test/metabase/server/middleware/security_test.clj
+++ b/test/metabase/server/middleware/security_test.clj
@@ -423,7 +423,7 @@
response (wrapped-handler {:headers {"origin" request-origin} :uri request-uri} identity identity)]
[enable-embedding-sdk embedding-app-origins-sdk request-origin request-uri (-> response :headers (get "Access-Control-Allow-Origin"))])))))
-(deftest add-cors-headers-for-auth-sso-test
+(deftest ^:parallel add-cors-headers-for-auth-sso-test
(testing "Should add CORS headers for /auth/sso endpoint with 402 status (embedding disabled errors)"
(let [wrapped-handler (mw.security/add-security-headers
(fn [_request respond _raise]
@@ -438,7 +438,9 @@
(is (= "*" (get-in response [:headers "Access-Control-Allow-Headers"]))
"Should set Access-Control-Allow-Headers to * for /auth/sso with 402 status")
(is (= "*" (get-in response [:headers "Access-Control-Allow-Methods"]))
- "Should set Access-Control-Allow-Methods to * for /auth/sso with 402 status")))
+ "Should set Access-Control-Allow-Methods to * for /auth/sso with 402 status"))))
+
+(deftest ^:parallel add-cors-headers-for-auth-sso-test-2
(testing "Should add CORS headers for /auth/sso endpoint with 400 status (client errors)"
(let [wrapped-handler (mw.security/add-security-headers
(fn [_request respond _raise]
@@ -453,7 +455,9 @@
(is (= "*" (get-in response [:headers "Access-Control-Allow-Headers"]))
"Should set Access-Control-Allow-Headers to * for /auth/sso with 400 status")
(is (= "*" (get-in response [:headers "Access-Control-Allow-Methods"]))
- "Should set Access-Control-Allow-Methods to * for /auth/sso with 400 status")))
+ "Should set Access-Control-Allow-Methods to * for /auth/sso with 400 status"))))
+
+(deftest ^:parallel add-cors-headers-for-auth-sso-test-3
(testing "Should add CORS headers for /auth/sso OPTIONS requests (preflight)"
(let [wrapped-handler (mw.security/add-security-headers
(fn [_request respond _raise]
@@ -470,7 +474,9 @@
(is (= "*" (get-in response [:headers "Access-Control-Allow-Headers"]))
"Should set Access-Control-Allow-Headers to * for OPTIONS /auth/sso")
(is (= "*" (get-in response [:headers "Access-Control-Allow-Methods"]))
- "Should set Access-Control-Allow-Methods to * for OPTIONS /auth/sso")))
+ "Should set Access-Control-Allow-Methods to * for OPTIONS /auth/sso"))))
+
+(deftest ^:parallel add-cors-headers-for-auth-sso-test-4
(testing "Should not add CORS headers for /auth/sso endpoint with other status codes"
(doseq [status [200 201 500 503]]
(let [wrapped-handler (mw.security/add-security-headers
diff --git a/test/metabase/session/models/session_test.clj b/test/metabase/session/models/session_test.clj
index b7edc1fb077..76c8bf9d7a8 100644
--- a/test/metabase/session/models/session_test.clj
+++ b/test/metabase/session/models/session_test.clj
@@ -102,7 +102,9 @@
(mt/reset-inbox!)
(mt/with-temp [:model/LoginHistory _ {:user_id user-id, :device_id device}]
(is (= {}
- @mt/inbox))))))))))))
+ @mt/inbox)))))))))))))
+
+(deftest send-email-on-first-login-from-new-device-test-2
(testing "don't send email if the setting is disabled by setting MB_SEND_EMAIL_ON_FIRST_LOGIN_FROM_NEW_DEVICE=FALSE"
(mt/with-temp [:model/User {user-id :id}]
(mt/with-fake-inbox
diff --git a/test/metabase/settings_rest/api_test.clj b/test/metabase/settings_rest/api_test.clj
index 0db059000e5..2012bb47007 100644
--- a/test/metabase/settings_rest/api_test.clj
+++ b/test/metabase/settings_rest/api_test.clj
@@ -116,7 +116,9 @@
(test-admin-write-authed-read-visibility! nil))
(testing "Check that non-admins are denied access"
(is (= "You don't have permissions to do that."
- (mt/user-http-request :rasta :get 403 "setting")))))
+ (mt/user-http-request :rasta :get 403 "setting"))))))
+
+(deftest fetch-setting-test-2
(testing "GET /api/setting/:key"
(testing "Test that admins can fetch a single Setting"
(models.setting-test/test-setting-2! "OK!")
diff --git a/test/metabase/slackbot/api_test.clj b/test/metabase/slackbot/api_test.clj
index 456b334b334..ff6da3e8442 100644
--- a/test/metabase/slackbot/api_test.clj
+++ b/test/metabase/slackbot/api_test.clj
@@ -622,7 +622,9 @@
(is (= 1 (count @update-calls)))
(is (= channel-id (:channel (first @update-calls))))
(is (= message-ts (:ts (first @update-calls))))
- (is (str/includes? (:text (first @update-calls)) "removed"))))))))))
+ (is (str/includes? (:text (first @update-calls)) "removed")))))))))))
+
+(deftest handle-delete-reaction-test-2
(testing "reaction_added with a non-delete emoji is ignored"
(tu/with-slackbot-setup
(let [event-body {:type "event_callback"
@@ -640,7 +642,9 @@
(tu/slack-request-options event-body)
event-body)
(Thread/sleep 200)
- (is (= 0 (count @update-calls)) "non-delete emoji should produce no update"))))))
+ (is (= 0 (count @update-calls)) "non-delete emoji should produce no update")))))))
+
+(deftest handle-delete-reaction-test-3
(testing "reaction_added with delete emoji from non-owner is ignored"
(tu/with-slackbot-setup
(let [event-body {:type "event_callback"
diff --git a/test/metabase/slackbot/query_test.clj b/test/metabase/slackbot/query_test.clj
index 53a3865d4fc..83311e7abf7 100644
--- a/test/metabase/slackbot/query_test.clj
+++ b/test/metabase/slackbot/query_test.clj
@@ -97,7 +97,7 @@
(testing "returns parseable PNG"
(is (some? image))))))))
-(deftest render-dimensions-test
+(deftest ^:parallel render-dimensions-test
(testing "render-dimensions calculates width from display type aspect ratios"
(testing "bar chart uses 2:1 ratio (12:6 default)"
(is (= {:width 1280 :height 640}
@@ -111,7 +111,7 @@
;;; ------------------------------------------------ Table Blocks ----------------------------------------------------
-(deftest format-results-as-table-blocks-test
+(deftest ^:parallel format-results-as-table-blocks-test
(testing "format-results-as-table-blocks creates valid Slack table block structure"
(let [results {:data {:rows [[1 "Alice" 100.50]
[2 "Bob" 200.75]]
@@ -141,8 +141,9 @@
settings (:column_settings table-block)]
(is (= "right" (:align (nth settings 0)))) ; ID is integer
(is (= "left" (:align (nth settings 1)))) ; Name is text
- (is (= "right" (:align (nth settings 2)))))))) ; Amount is float
+ (is (= "right" (:align (nth settings 2))))))))) ; Amount is float
+(deftest ^:parallel format-results-as-table-blocks-test-2
(testing "format-results-as-table-blocks truncates large results"
(let [many-rows (vec (repeat 150 [1 "test"]))
results {:data {:rows many-rows
@@ -157,7 +158,9 @@
(let [context-block (second blocks)]
(is (= "context" (:type context-block)))
(is (= "Showing 99 of 150 rows"
- (get-in context-block [:elements 0 :text])))))))
+ (get-in context-block [:elements 0 :text]))))))))
+
+(deftest ^:parallel format-results-as-table-blocks-test-3
(testing "format-results-as-table-blocks handles scalar (single-cell) results"
(let [results {:data {:rows [[42]]
:cols [{:name "count" :display_name "Count" :base_type :type/Integer}]}}
@@ -167,13 +170,17 @@
rows (:rows table-block)]
(is (= 2 (count rows))) ; 1 header + 1 data row
(is (= "Count" (get-in rows [0 0 :text])))
- (is (= "42" (get-in rows [1 0 :text])))))))
+ (is (= "42" (get-in rows [1 0 :text]))))))))
+
+(deftest ^:parallel format-results-as-table-blocks-test-4
(testing "format-results-as-table-blocks handles empty results"
(let [results {:data {:rows []
:cols [{:name "count" :display_name "Count" :base_type :type/Integer}]}}
blocks (slackbot.query/format-results-as-table-blocks results)]
(testing "returns no-data block"
- (is (= "No data" (get-in blocks [0 :rows 0 0 :text]))))))
+ (is (= "No data" (get-in blocks [0 :rows 0 0 :text])))))))
+
+(deftest ^:parallel format-results-as-table-blocks-test-5
(testing "format-results-as-table-blocks truncates long cell values"
(binding [slackbot.query/*slack-table-max-cell-length* 20]
(let [long-text (apply str (repeat 50 "x"))
@@ -183,7 +190,9 @@
blocks (slackbot.query/format-results-as-table-blocks results)
cell-text (get-in (first blocks) [:rows 1 1 :text])]
(is (<= (count cell-text) 20))
- (is (str/ends-with? cell-text "…")))))
+ (is (str/ends-with? cell-text "…"))))))
+
+(deftest ^:parallel format-results-as-table-blocks-test-6
(testing "format-results-as-table-blocks truncates rows to fit character budget"
(binding [slackbot.query/*slack-table-max-chars* 100]
(let [results {:data {:rows (vec (repeat 20 ["abcdefghij"]))
@@ -198,7 +207,9 @@
(testing "total cell text fits within character budget"
(let [total-chars (transduce (comp cat (map (comp count :text)))
+ (:rows (first blocks)))]
- (is (<= total-chars 100)))))))
+ (is (<= total-chars 100))))))))
+
+(deftest ^:parallel format-results-as-table-blocks-test-7
(testing "format-results-as-table-blocks handles FK remapped columns"
(let [;; Simulate FK remapping: USER_ID is remapped to show USER.NAME
;; The data has both USER_ID (raw FK) and NAME (human-readable value from FK target)
diff --git a/test/metabase/transforms_base/ordering_test.clj b/test/metabase/transforms_base/ordering_test.clj
index e49c5c1dbe3..228bb533c6d 100644
--- a/test/metabase/transforms_base/ordering_test.clj
+++ b/test/metabase/transforms_base/ordering_test.clj
@@ -308,7 +308,9 @@
(assoc :target_table_id table1))]
(is (= {:cycle-str "transform_table_1"
:cycle [t1]}
- (ordering/get-transform-cycle (t2/select-one :model/Transform :id t1))))))
+ (ordering/get-transform-cycle (t2/select-one :model/Transform :id t1)))))))
+
+(deftest get-transform-cycle-test-2
(testing "cycle is caught in 2 transforms referencing each other"
(mt/with-temp [:model/Table {table1 :id} {:schema (default-schema-or-public), :name "table_1"}
:model/Field _ {:table_id table1
@@ -330,7 +332,9 @@
(assoc :target_table_id table1))]
(is (= {:cycle-str "transform_table_2 -> transform_table_1",
:cycle [t1 t2]}
- (ordering/get-transform-cycle (t2/select-one :model/Transform :id t1))))))
+ (ordering/get-transform-cycle (t2/select-one :model/Transform :id t1)))))))
+
+(deftest get-transform-cycle-test-3
(testing "cycle is detected in 3 transforms referencing each other"
(mt/with-temp [:model/Table {table1 :id} {:schema (default-schema-or-public)
:name "table_1"}
diff --git a/test/metabase/util/date_2_test.clj b/test/metabase/util/date_2_test.clj
index cdb7292508d..87020bca35e 100644
--- a/test/metabase/util/date_2_test.clj
+++ b/test/metabase/util/date_2_test.clj
@@ -425,7 +425,9 @@
(comparison-range :>= nil)))
(testing "exclusive start"
(is (= {:start (t/local-date "2019-10-31")}
- (comparison-range :>= {:start :exclusive})))))))
+ (comparison-range :>= {:start :exclusive}))))))))
+
+(deftest ^:parallel comparison-range-test-2
(testing "Comparing DAY"
(letfn [(comparison-range [comparison-type options]
(u.date/comparison-range (t/local-date-time "2019-11-18T12:00") :day comparison-type (merge {:resolution :minute} options)))]
diff --git a/test/metabase/util/i18n/plural_test.clj b/test/metabase/util/i18n/plural_test.clj
index 4a2776084b6..9bc1ed21a2a 100644
--- a/test/metabase/util/i18n/plural_test.clj
+++ b/test/metabase/util/i18n/plural_test.clj
@@ -10,7 +10,7 @@
([formula n]
(i18n.plural/index (str "plural=" formula) n)))
-(deftest basic-arithmetic-test
+(deftest ^:parallel basic-arithmetic-test
(testing "basic arithmetic"
(are [formula expected] (= expected (compute formula))
"0" 0
@@ -75,7 +75,9 @@
"1 < 2 ? 1 || 0 : 0" 1
"1 > 2 ? 1 : 1 && 0" 0
"1 > 2 ? 0 : 1 < 1 ? 1 : 2" 2
- "1 < 2 ? 1 < 3 ? 1 : 2 : 3" 1))
+ "1 < 2 ? 1 < 3 ? 1 : 2 : 3" 1)))
+
+(deftest ^:parallel basic-arithmetic-test-2
(testing "Error cases"
(are [formula] (insta/failure? (compute formula))
;; Empty formulas
@@ -99,31 +101,39 @@
"0.3"
".9")))
-(deftest locale-pluralization-test
+(deftest ^:parallel locale-pluralization-test
;; This test uses selected example Plural-Forms from https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
;; These do not necessarily correspond to languages available in Metabase.
(testing "English, German, Dutch, Spanish, Portuguese, etc"
(are [n expected] (= expected (compute "n != 1" n))
0 1
1 0
- 2 1))
+ 2 1)))
+
+(deftest ^:parallel locale-pluralization-test-2
(testing "French"
(are [n expected] (= expected (compute "n > 1" n))
0 0
1 0
- 2 1))
+ 2 1)))
+
+(deftest ^:parallel locale-pluralization-test-3
(testing "Latvian"
(are [n expected] (= expected (compute "n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2" n))
0 2
1 0
11 1
21 0
- 111 1))
+ 111 1)))
+
+(deftest ^:parallel locale-pluralization-test-4
(testing "Irish"
(are [n expected] (= expected (compute "n==1 ? 0 : n==2 ? 1 : 2" n))
1 0
2 1
- 3 2))
+ 3 2)))
+
+(deftest ^:parallel locale-pluralization-test-5
(testing "Romanian"
(are [n expected] (= expected (compute "n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2" n))
0 1
@@ -132,7 +142,9 @@
19 1
20 2
100 2
- 101 1))
+ 101 1)))
+
+(deftest ^:parallel locale-pluralization-test-6
(testing "Russian, Ukrainian, Serbian"
(are [n expected] (= expected (compute (str "n%10==1 && n%100!=11 ? 0 :"
"n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2")
@@ -144,7 +156,9 @@
101 0
102 1
109 2
- 110 2))
+ 110 2)))
+
+(deftest ^:parallel locale-pluralization-test-7
(testing "Czech, Slovak"
(are [n expected] (= expected (compute "(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2" n))
0 2
@@ -152,7 +166,9 @@
2 1
3 1
4 1
- 5 2))
+ 5 2)))
+
+(deftest ^:parallel locale-pluralization-test-8
(testing "Polish"
(are [n expected] (= expected (compute (str "n==1 ? 0 :"
"n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2")
diff --git a/test/metabase/util/i18n_test.clj b/test/metabase/util/i18n_test.clj
index eb8133f44c0..ea0efc09351 100644
--- a/test/metabase/util/i18n_test.clj
+++ b/test/metabase/util/i18n_test.clj
@@ -163,7 +163,9 @@
(is (thrown-with-msg?
AssertionError
#"missing some \{\} placeholders\. Expected \{0\}, \{1\}"
- (#'i18n/validate-number-of-args "{1}" [0 1]))))))
+ (#'i18n/validate-number-of-args "{1}" [0 1])))))))
+
+(deftest ^:parallel validate-number-of-args-test-2
(testing "The number of args is still validated if the first argument is a `str` form"
(is (thrown?
clojure.lang.Compiler$CompilerException
@@ -171,7 +173,9 @@
(is (thrown-with-msg?
AssertionError
#"expects 2 args, got 1"
- (#'i18n/validate-number-of-args '(str "{0}" "{1}") [0]))))
+ (#'i18n/validate-number-of-args '(str "{0}" "{1}") [0])))))
+
+(deftest ^:parallel validate-number-of-args-test-3
(testing "`trsn` and `trun` should validate that they are being called with at most one arg\n"
(is (thrown?
clojure.lang.Compiler$CompilerException
diff --git a/test/metabase/util/time_test.cljc b/test/metabase/util/time_test.cljc
index 4ddacfad163..ea315039de7 100644
--- a/test/metabase/util/time_test.cljc
+++ b/test/metabase/util/time_test.cljc
@@ -116,11 +116,15 @@
"2022-01-01T00:00:00" 2022 "year"
"1954-01-01T00:00:00" 1954 "year"
- "2044-01-01T00:00:00" 2044 "year")))
+ "2044-01-01T00:00:00" 2044 "year"))))
+
+(deftest ^:parallel string->timestamp-test-2
(testing "numbers with no unit are parsed as year numbers"
(are [exp-str input] (same? (from-zulu exp-str) (shared.ut/coerce-to-timestamp input {}))
"1950-01-01T00:00:00Z" 1950
- "2015-01-01T00:00:00Z" 2015))
+ "2015-01-01T00:00:00Z" 2015)))
+
+(deftest string->timestamp-test-3
(testing "strings"
(testing "with unit=day-of-week get parsed as eg. Mon"
(with-redefs [internal/now (fn [] (from test-epoch))]
@@ -141,7 +145,9 @@
"2022-12-14T17:07:00Z" "2022-12-14T13:37:00-03:30"))
(testing "and no time offset are assumed to be UTC"
(is (same? (from-zulu "2022-12-14T13:37:45Z")
- (shared.ut/coerce-to-timestamp "2022-12-14T13:37:45" {}))))))
+ (shared.ut/coerce-to-timestamp "2022-12-14T13:37:45" {})))))))
+
+(deftest ^:parallel string->timestamp-test-4
(testing "existing date-time values are simply returned"
(are [value] (let [t (shared.ut/coerce-to-timestamp value)] (same? t (shared.ut/coerce-to-timestamp t)))
"2022-12-12T00:00:00"
diff --git a/test/metabase/warehouse_schema_rest/api/table_test.clj b/test/metabase/warehouse_schema_rest/api/table_test.clj
index ba5c847c6f0..7487d5a747d 100644
--- a/test/metabase/warehouse_schema_rest/api/table_test.clj
+++ b/test/metabase/warehouse_schema_rest/api/table_test.clj
@@ -559,7 +559,9 @@
(testing "Update table's properties shouldn't trigger sync"
(set-name!)
(is (= 2
- @called)))))))))
+ @called))))))))))
+
+(deftest update-table-sync-test-2
(testing "Bulk updating visibility"
(let [unhidden-ids (atom #{})]
(mt/with-temp [:model/Table {id-1 :id} {}