Skip to content
Snippets Groups Projects
Commit 2c8296bb authored by Simon Belak's avatar Simon Belak
Browse files

Add tests for waiting on analysis to finish

parent cae707f5
Branches
Tags
No related merge requests found
......@@ -15,6 +15,7 @@
[metabase.test.data :as data]
[metabase.test.data.users :as test-users]
[metabase.test.util :as tu]
[toucan.db :as db]
[toucan.util.test :as tt]))
(defmacro with-rasta
......@@ -122,6 +123,32 @@
(-> q (automagic-analysis {:cell-query [:= [:field-id (data/id :venues :category_id) 2]]}) some?)))))
(expect
[true true]
(tt/with-temp* [Table [{table-id :id}]]
(with-rasta
(with-dashboard-cleanup
(let [table (Table table-id)
not-analyzed-result (automagic-analysis table {})
analyzed-result (-> table
(assoc :entity_type :entity/GenericTable)
(automagic-analysis {}))]
[(nil? not-analyzed-result) (some? analyzed-result)])))))
(expect
true
(tt/with-temp* [Database [{db-id :id}]
Table [{table-id :id} {:db_id db-id}]
Field [{} {:table_id table-id}]
Field [{} {:table_id table-id}]]
(with-rasta
(with-dashboard-cleanup
(let [database (Database db-id)
not-analyzed-count (count (candidate-tables database))]
(db/update! Table table-id :entity_type :entity/GenericTable)
(= (inc not-analyzed-count) (count (candidate-tables database))))))))
(expect
4
(->> (Database (data/id)) candidate-tables first :tables count))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment