Skip to content

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

Quick ci test disabling (#63030)

dpsutton9191713854f0
diff --git a/.github/actions/prepare-backend/action.yml b/.github/actions/prepare-backend/action.yml
index 0f86d64ed07..f0dddb5c68e 100644
--- a/.github/actions/prepare-backend/action.yml
+++ b/.github/actions/prepare-backend/action.yml
@@ -1,4 +1,7 @@
name: Prepare back-end environment
+description: |
+ Prepare the backend. Installs jdk, Clojure, and fetches the cache for m2. The CI config fetchs `ci-test-config.json`
+ from master and lets us ignore tests at the var level if they are flaking.
inputs:
java-version:
required: true
@@ -21,9 +24,14 @@ runs:
distribution: 'temurin'
- name: Install Clojure CLI
shell: bash
+ continue-on-error: true
run: |
curl -O https://download.clojure.org/install/linux-install-${{ inputs.clojure-version }}.sh &&
sudo bash ./linux-install-${{ inputs.clojure-version }}.sh
+ - name: Fetch CI config
+ shell: bash
+ run: |
+ curl -o ci-test-config.json https://raw.githubusercontent.com/metabase/metabase/refs/heads/master/ci-test-config.json
- name: Check to see if dependencies should be cached
if: ${{ contains(github.event.head_commit.message, '[ci nocache]') }}
run: echo "Commit message includes [ci nocache]; dependencies will NOT be cached"
diff --git a/ci-test-config.json b/ci-test-config.json
new file mode 100644
index 00000000000..8433a1ac9de
--- /dev/null
+++ b/ci-test-config.json
@@ -0,0 +1,11 @@
+{
+ "version": "1.0.0",
+ "ignored": {
+ "vars": []
+ },
+ "metadata": {
+ "last_updated": "2025-08-02",
+ "updated_by": "engineering-team",
+ "reason": "Initial, and empty, ci test config"
+ }
+}
diff --git a/deps.edn b/deps.edn
index 50c498d5249..8f822acaf8e 100644
--- a/deps.edn
+++ b/deps.edn
@@ -255,7 +255,7 @@
criterium/criterium {:mvn/version "0.4.6"} ; benchmarking library
djblue/portal {:mvn/version "0.60.2"} ; ui for inspecting values
io.github.camsaul/humane-are {:mvn/version "1.0.2"} ; cleaner test output
- io.github.metabase/hawk {:sha "1fe839cfa48549e21b89c6418c747895eda7e7bc"} ; test runner
+ io.github.metabase/hawk {:mvn/version "1.0.11"} ; test runner
jonase/eastwood {:mvn/version "1.4.3" ; inspects namespaces and reports possible problems using tools.analyzer
:exclusions
[org.ow2.asm/asm-all]}
@@ -409,7 +409,7 @@
cider/piggieback {:mvn/version "0.6.0"}
cljs-bean/cljs-bean {:mvn/version "1.9.0"}
com.lambdaisland/glogi {:mvn/version "1.3.169"}
- io.github.metabase/hawk {:mvn/version "1.0.7"}
+ io.github.metabase/hawk {:mvn/version "1.0.11"}
org.clojars.mmb90/cljs-cache {:mvn/version "0.1.4"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.11.0"}
;; keep it in sync with package.json
diff --git a/test/metabase/test_runner.clj b/test/metabase/test_runner.clj
index b93dc584f9d..bac7aad3f7b 100644
--- a/test/metabase/test_runner.clj
+++ b/test/metabase/test_runner.clj
@@ -2,6 +2,8 @@
(ns metabase.test-runner
"The only purpose of this namespace is to make sure all of the other stuff below gets loaded."
(:require
+ #_{:clj-kondo/ignore [:discouraged-namespace]}
+ [cheshire.core :as json]
[clojure.java.classpath :as classpath]
[clojure.java.io :as io]
[clojure.set :as set]
@@ -51,7 +53,7 @@
(defn- all-drivers []
(into #{:h2 :postgres :mysql}
(for [^java.io.File file (.listFiles (io/file "modules/drivers"))
- :when (.isDirectory file)]
+ :when (.isDirectory file)]
(keyword (.getName file)))))
(defn- excluded-drivers []
@@ -62,16 +64,16 @@
[_nil options]
(let [excluded-driver-dirs (for [driver (excluded-drivers)]
(format "modules/drivers/%s" (name driver)))
- exclude-directory? (fn [dir]
- (let [dir (str dir)]
- (some (fn [excluded]
- (or (str/ends-with? dir excluded)
- (str/includes? dir (str excluded "/"))))
- excluded-driver-dirs)))
- directories (for [^java.io.File file (classpath/system-classpath)
- :when (and (.isDirectory file)
- (not (exclude-directory? file)))]
- file)]
+ exclude-directory? (fn [dir]
+ (let [dir (str dir)]
+ (some (fn [excluded]
+ (or (str/ends-with? dir excluded)
+ (str/includes? dir (str excluded "/"))))
+ excluded-driver-dirs)))
+ directories (for [^java.io.File file (classpath/system-classpath)
+ :when (and (.isDirectory file)
+ (not (exclude-directory? file)))]
+ file)]
(hawk/find-tests directories options)))
(def ^:private excluded-directories
@@ -87,17 +89,70 @@
"test_config"
"test_resources"])
-(defn- default-options []
- {:namespace-pattern #"^(?:(?:metabase.*)|(?:hooks\..*))" ; anything starting with `metabase*` (including `metabase-enterprise`) or `hooks.*`
- :exclude-directories excluded-directories
- :test-warn-time 3000})
+(defn- json-config->edn-ignored
+ "Convert JSON config to hawk's EDN ignored format. Right now we only support individually ignored vars. In the future
+ will extend to namespaces, drivers. Ideally e2e tests as well. Example config:
+ ```javascript
+ {
+ \"ignored\": {
+ \"vars\": [
+ \"metabase.util.queue-test/bounded-transfer-queue-test\",
+ \"metabase.util.queue-test/take-batch-test\"
+ ]
+ }
+ }
+ ```"
+ [json-config]
+ (try
+ (let [{:keys [ignored] :as config} (json/parse-string (slurp json-config) true)]
+ (when (seq ignored)
+ #_{:clj-kondo/ignore [:discouraged-var]}
+ (println (format "using config file: \n%s\n" config)))
+ (cond-> {}
+ (seq (:vars ignored))
+ (assoc :vars (-> ignored :vars set))))
+ (catch Exception e
+ (log/warnf "Error parsing json config: %s '%s'" json-config (ex-message e)))))
+
+(defn- default-options
+ "Default options for test runner, with optional CI config integration."
+ ([]
+ (default-options {}))
+ ([{:keys [ci-config-file]
+ :or {ci-config-file "ci-test-config.json"}}]
+ (let [base-options {:namespace-pattern #"^(?:(?:metabase.*)|(?:hooks\..*))" ; anything starting with `metabase*` (including `metabase-enterprise`) or `hooks.*`
+ :exclude-directories excluded-directories
+ :test-warn-time 3000}]
+ (cond (and ci-config-file (.exists (io/file ci-config-file)))
+ (do
+ #_{:clj-kondo/ignore [:discouraged-var]}
+ (println (format "Loading CI config file from %s" ci-config-file))
+ (assoc base-options :ignored (json-config->edn-ignored ci-config-file)))
+ ci-config-file
+ (do (log/warnf "CI config file was specified but does not exist: %s" ci-config-file)
+ base-options)
+ :else
+ base-options))))
+
+(defn- build-final-options
+ "Build final options by merging defaults, CI config, and runtime options.
+ This centralizes all the option merging logic in one place."
+ [runtime-options]
+ (let [default-opts (default-options runtime-options)
+ runtime-ignored (:ignored runtime-options)
+ ;; Simple merge: if both have :ignored, merge them; otherwise use whichever exists
+ final-ignored (if (and (:ignored default-opts) runtime-ignored)
+ (merge-with set/union (:ignored default-opts) runtime-ignored)
+ (or runtime-ignored (:ignored default-opts)))]
+ (-> (merge default-opts runtime-options)
+ (cond-> (seq final-ignored) (assoc :ignored final-ignored)))))
(defn find-tests
"Find all tests, in case you wish to run them yourself."
([]
(find-tests {}))
([options]
- (hawk/find-tests-with-options (merge (default-options) options))))
+ (hawk/find-tests-with-options (build-final-options options))))
(defn- initialize-all-fixtures []
(let [steps (initialize/all-components)]
@@ -110,10 +165,10 @@
"Find and run tests from the REPL."
[options]
(initialize-all-fixtures)
- (hawk/find-and-run-tests-repl (merge (default-options) options)))
+ (hawk/find-and-run-tests-repl (build-final-options options)))
(defn find-and-run-tests-cli
"Entrypoint for `clojure -X:test`."
[options]
(initialize-all-fixtures)
- (hawk/find-and-run-tests-cli (merge (default-options) options)))
+ (hawk/find-and-run-tests-cli (build-final-options options)))