The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
test files trigger module change, workspaces trigger drivers (#69358)
dpsuttond77f52936e45
diff --git a/mage/src/mage/modules.clj b/mage/src/mage/modules.cljindex d34152da1b2..8fff0ee171a 100644--- a/mage/src/mage/modules.clj+++ b/mage/src/mage/modules.clj@@ -19,7 +19,7 @@(def modules-triggering-cloud-drivers"Modules not only trigger driver tests, but run cloud drivers as well. Can be duplicative to driver triggers."'#{query-processor transforms- enterprise/transforms enterprise/transforms-python})+ enterprise/transforms enterprise/transforms-python enterprise/workspaces});;; TODO (Cam 2025-11-07) changes to test files should only cause us to run tests for that module as well, not;;; everything that depends on that module directly or indirectly in `src`@@ -199,19 +199,6 @@filename))(u/updated-files (or git-ref "master"))))-(defn- remove-non-driver-test-namespaces [files]- (into []- (remove (fn [filename]- (when (and (some #(str/includes? filename %)- ["test/" "enterprise/backend/test/"])- (not (some #(str/includes? filename %)- ["query_processor"- "driver"])))- (when-not *github-output-only?*- (println (str "Ignorning changes in test namespace " (pr-str filename))))- filename)))- files))-(defn driver-deps-affected?"Returns true if any of `trigger-modules` are affected by the changed modules.1-arity and 2-arity use [[default-modules-which-trigger-drivers]] for backwards compatibility."@@ -234,7 +221,7 @@[[git-ref, :as _arguments]](let [deps (dependencies)git-ref (or git-ref "master")- updated-files (remove-non-driver-test-namespaces (u/updated-files git-ref))+ updated-files (u/updated-files git-ref)updated (updated-files->updated-modules updated-files)drivers-affected? (driver-deps-affected? deps updated)];; Not strictly necessary, but people looking at CI will appreciate having this extra info.@@ -438,8 +425,7 @@:particular-driver-changed? particular-driver-changed?:verbose? (not github-output-only?)}quarantined (quarantined-drivers)- updated-files (remove-non-driver-test-namespaces- (u/updated-files git-ref))+ updated-files (u/updated-files git-ref)updated (updated-files->updated-modules updated-files)driver-affected? (driver-deps-affected? updated)important-file-changed? (changes-important-file-for-drivers? git-ref)diff --git a/mage/test/mage/modules_test.clj b/mage/test/mage/modules_test.cljindex f619f434898..899bf45ecfa 100644--- a/mage/test/mage/modules_test.clj+++ b/mage/test/mage/modules_test.clj@@ -168,7 +168,7 @@(deftest modules-can-trigger-cloud-drivers(doseq [module '#{query-processor transforms- enterprise/transforms enterprise/transforms-python}+ enterprise/transforms enterprise/transforms-python enterprise/workspaces}driver [:athena :bigquery :databricks :redshift :snowflake]](testing (format "Cloud driver runs when %s module is updated" module)(let [result (mage.modules/driver-decision driver@@ -253,7 +253,7 @@(let [modules-triggering-drivers (modules-affecting-drivers);; This count was 33 as of 2026-01-20. Update this number ONLY if you;; intentionally want more modules to trigger driver tests.- max-allowed-count 35]+ max-allowed-count 36](is (<= (count modules-triggering-drivers) max-allowed-count)(format "Too many modules trigger driver tests! Expected <= %d, got %d.Modules triggering driver tests: %s@@ -262,3 +262,14 @@max-allowed-count(count modules-triggering-drivers)(pr-str (sort modules-triggering-drivers)))))))++(deftest test-files-mark-modules-changes+ (testing "if you change a test in a module, that module is affected"+ ;; note in the future, this won't be all dependent modules see+ ;; https://linear.app/metabase/issue/DEV-1487/treat-changed-test-namespaces-as-module-only-changes+ (let [changed-file "enterprise/backend/test/metabase_enterprise/workspaces/api_test.clj"]+ (is (= '#{enterprise/workspaces}+ (mage.modules/updated-files->updated-modules [changed-file])))+ (is (-> [changed-file]+ mage.modules/updated-files->updated-modules+ mage.modules/driver-deps-affected?)))))