Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

fix(test) reflection error in metabot conv test (#73491)

Tyler Pludecc6dfb78fcc7
diff --git a/enterprise/backend/test/metabase_enterprise/metabot_analytics/v_metabot_conversations_test.clj b/enterprise/backend/test/metabase_enterprise/metabot_analytics/v_metabot_conversations_test.clj
index ad139776660..a912cbcc7de 100644
--- a/enterprise/backend/test/metabase_enterprise/metabot_analytics/v_metabot_conversations_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/metabot_analytics/v_metabot_conversations_test.clj
@@ -2,6 +2,7 @@
"Tests for the `v_metabot_conversations` SQL view."
(:require
[clojure.test :refer [deftest is testing]]
+ [java-time.api :as t]
[metabase.test :as mt]
[toucan2.core :as t2]))
@@ -329,7 +330,7 @@
:model/MetabotMessage _ {:conversation_id convo-id :role "assistant" :profile_id "nlq" :total_tokens 0 :data [] :created_at t3 :deleted_at t3}]
(let [row (first (query-view [convo-id]))]
;; Compare instants to avoid DB-specific timestamp type differences
- (is (= (.toInstant t2-ts) (.toInstant (:last_message_at row)))))))))
+ (is (= (t/instant t2-ts) (t/instant (:last_message_at row)))))))))
(deftest multiple-conversations-independent-test
(testing "multiple conversations aggregate independently"
diff --git a/enterprise/backend/test/metabase_enterprise/metabot_analytics/v_metabot_messages_test.clj b/enterprise/backend/test/metabase_enterprise/metabot_analytics/v_metabot_messages_test.clj
index 4a6a41aab33..c84a14f3514 100644
--- a/enterprise/backend/test/metabase_enterprise/metabot_analytics/v_metabot_messages_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/metabot_analytics/v_metabot_messages_test.clj
@@ -2,6 +2,7 @@
"Tests for the `v_metabot_messages` SQL view."
(:require
[clojure.test :refer [deftest is testing]]
+ [java-time.api :as t]
[metabase.test :as mt]
[toucan2.core :as t2]))
@@ -129,4 +130,4 @@
:data []
:created_at msg-time}]
(let [row (find-row (query-view [convo-id]) msg-id)]
- (is (= (.toInstant msg-time) (.toInstant ^java.time.OffsetDateTime (:created_at row)))))))))
+ (is (= (t/instant msg-time) (t/instant (:created_at row)))))))))