Skip to content
Snippets Groups Projects
Unverified Commit 516f03f5 authored by Case Nelson's avatar Case Nelson Committed by GitHub
Browse files

fix: tests for clickhouse development (#49347)

parent bd0a0080
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
[clj-kondo.hooks-api :as api] [clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils] [clj-kondo.impl.utils]
[clojure.edn :as edn] [clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.test :refer :all] [clojure.test :refer :all]
[hooks.clojure.test])) [hooks.clojure.test]))
...@@ -44,9 +43,13 @@ ...@@ -44,9 +43,13 @@
(testing "Make sure we keep hooks.clojure.test/driver-keywords up to date" (testing "Make sure we keep hooks.clojure.test/driver-keywords up to date"
(let [driver-keywords (-> (slurp ".clj-kondo/config.edn") (let [driver-keywords (-> (slurp ".clj-kondo/config.edn")
edn/read-string edn/read-string
(get-in [:linters :metabase/disallow-hardcoded-driver-names-in-tests :drivers]))] (get-in [:linters :metabase/disallow-hardcoded-driver-names-in-tests :drivers]))
(doseq [^java.io.File file (.listFiles (io/file "modules/drivers")) driver-modules (->> (slurp "modules/drivers/deps.edn")
:when (.isDirectory file) edn/read-string
:let [driver (keyword (.getName file))]] :deps
vals
(keep (comp keyword :local/root))
(into #{}))]
(doseq [driver driver-modules]
(is (contains? driver-keywords driver) (is (contains? driver-keywords driver)
(format "hooks.clojure.test/driver-keywords should contain %s, please add it" driver)))))) (format "hooks.clojure.test/driver-keywords should contain %s, please add it" driver))))))
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
(defn applicable-drivers (defn applicable-drivers
"Drivers that these pivot table tests should run on" "Drivers that these pivot table tests should run on"
[] []
(disj (mt/normal-drivers-with-feature :expressions :left-join) (disj (mt/normal-drivers-with-feature :expressions :left-join :metadata/key-constraints)
;; mongodb doesn't support foreign keys required by this test
:mongo
;; Disable on Redshift due to OutOfMemory issue (see #18834) ;; Disable on Redshift due to OutOfMemory issue (see #18834)
:redshift)) :redshift))
......
...@@ -61,7 +61,12 @@ ...@@ -61,7 +61,12 @@
(latest-view (mt/user->id :crowberto) (u/id coll)))))))) (latest-view (mt/user->id :crowberto) (u/id coll))))))))
(deftest update-view-dashboard-timestamp-test (deftest update-view-dashboard-timestamp-test
(let [now (t/offset-date-time) ;; the DB might save `last_used_at` with a different level of precision than the JVM does, on some machines
;; `offset-date-time` returns nanosecond precision (9 decimal places) but `last_viewed_at` is coming back with
;; microsecond precision (6 decimal places). We don't care about such a small difference, just strip it off of the
;; times we're comparing.
(let [now (-> (t/offset-date-time)
(.withNano 0))
one-hour-ago (t/minus now (t/hours 1)) one-hour-ago (t/minus now (t/hours 1))
two-hours-ago (t/minus now (t/hours 2))] two-hours-ago (t/minus now (t/hours 2))]
(testing "update with multiple dashboards of the same ids will set timestamp to the latest" (testing "update with multiple dashboards of the same ids will set timestamp to the latest"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment