Skip to content
Snippets Groups Projects
Commit aae4ca12 authored by Ryan Senior's avatar Ryan Senior
Browse files

Fix for a transient test issue on Snowflake [ci drivers]

Specifically two tests with a between date filter are failing. Only
sometimes and only when running the full test suite. The guess right
now is it's grabbing an old connection with a previous test
report-timezone already preset on the connection. This commit flushes
the connection pool before running the test (only on Snowflake).
parent 49935a73
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,9 @@
[query-processor-test :refer [first-row format-rows-by non-timeseries-engines rows]]]
[metabase.mbql.normalize :as normalize]
[metabase.query-processor.middleware.parameters.mbql :as mbql-params]
[metabase.test.data :as data]
[metabase.test
[data :as data]
[util :as tu]]
[metabase.test.data.datasets :as datasets]
[metabase.util.date :as du]))
......@@ -138,17 +140,20 @@
;; check that date ranges work correctly
(datasets/expect-with-engines params-test-engines
[29]
(first-row
(format-rows-by [int]
(qp/process-query {:database (data/id)
:type :query
:query {:source-table (data/id :checkins)
:aggregation [[:count]]}
:parameters [{:hash "abc123"
:name "foo"
:type "date"
:target [:dimension [:field-id (data/id :checkins :date)]]
:value "2015-04-01~2015-05-01"}]}))))
(do
;; Prevent an issue with Snowflake were a previous connection's report-timezone setting can affect this test's results
(when (= :snowflake datasets/*engine*) (tu/clear-connection-pool (data/id)))
(first-row
(format-rows-by [int]
(qp/process-query {:database (data/id)
:type :query
:query {:source-table (data/id :checkins)
:aggregation [[:count]]}
:parameters [{:hash "abc123"
:name "foo"
:type "date"
:target [:dimension [:field-id (data/id :checkins :date)]]
:value "2015-04-01~2015-05-01"}]})))))
;; check that IDs work correctly (passed in as numbers)
(datasets/expect-with-engines params-test-engines
......
(ns metabase.query-processor-test.filter-test
"Tests for the `:filter` clause."
(:require [metabase.query-processor-test :refer :all]
[metabase.test.data :as data]
[metabase.test
[data :as data]
[util :as tu]]
[metabase.test.data.datasets :as datasets]))
;;; ------------------------------------------------ "FILTER" CLAUSE -------------------------------------------------
......@@ -92,11 +94,14 @@
:columns ["count"]
:cols [(aggregate-col :count)]
:native_form true}
(->> (data/run-mbql-query checkins
{:aggregation [[:count]]
:filter [:between [:datetime-field $date :day] "2015-04-01" "2015-05-01"]})
booleanize-native-form
(format-rows-by [int])))
(do
;; Prevent an issue with Snowflake were a previous connection's report-timezone setting can affect this test's results
(when (= :snowflake datasets/*engine*) (tu/clear-connection-pool (data/id)))
(->> (data/run-mbql-query checkins
{:aggregation [[:count]]
:filter [:between [:datetime-field $date :day] "2015-04-01" "2015-05-01"]})
booleanize-native-form
(format-rows-by [int]))))
;;; FILTER -- "OR", "<=", "="
(expect-with-non-timeseries-dbs
......
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