Skip to content
Snippets Groups Projects
Commit 618bade5 authored by Callum Herries's avatar Callum Herries
Browse files

Test in multiple timezones

parent 53807816
No related branches found
No related tags found
No related merge requests found
......@@ -303,16 +303,18 @@
(mt/test-drivers (mt/normal-drivers-with-feature :date-arithmetics)
(testing "should return the current time"
;; Allow a 30 second window for the current time to account for any difference between the time in Clojure and the DB
(is (= true
(-> (mt/run-mbql-query venues
{:expressions {"1" [:now]}
:fields [[:expression "1"]]
:limit 1})
mt/rows
ffirst
u.date/parse
(t/zoned-date-time (t/zone-id "UTC")) ; needed for sqlite, which returns a local date time
(close? (t/instant) (t/seconds 30))))))
(doseq [timezone [nil "America/Los_Angeles"]]
(mt/with-temporary-setting-values [report-timezone timezone]
(is (= true
(-> (mt/run-mbql-query venues
{:expressions {"1" [:now]}
:fields [[:expression "1"]]
:limit 1})
mt/rows
ffirst
u.date/parse
(t/zoned-date-time (t/zone-id "UTC")) ; needed for sqlite, which returns a local date time
(close? (t/instant) (t/seconds 30))))))))
(testing "should return a datetime with second precision"
(is (= true
(-> (mt/run-mbql-query venues
......@@ -347,6 +349,8 @@
:limit 1})
mt/rows first))))))
(mt/set-test-drivers! #{:presto-jdbc})
(deftest datetime-math-with-extract-test
(mt/test-drivers (mt/normal-drivers-with-feature :date-arithmetics)
(mt/dataset times-mixed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment