The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fix metabot snowplow test flakes (#71337)
applebyea43a75160dc
diff --git a/test/metabase/metabot/self_test.clj b/test/metabase/metabot/self_test.cljindex c836fd64a3d..2bf6667215a 100644--- a/test/metabase/metabot/self_test.clj+++ b/test/metabase/metabot/self_test.clj@@ -733,24 +733,28 @@(mt/with-current-user rasta-id(snowplow-test/with-fake-snowplow-collector(run! identity (self/call-llm "openrouter/test-model" nil [] test-util/TOOLS snowplow-tracking-opts))- (is (=? [{:user-id (str rasta-id)- :data {"model_id" "openrouter/test-model"- "total_tokens" 120- "prompt_tokens" 100- "completion_tokens" 20- "estimated_costs_usd" 0.0- "duration_ms" nat-int?- "source" "test-source"- "tag" "test-tag"- "session_id" "00000000-0000-0000-0000-000000000002"}}- {:user-id (str rasta-id)- :data {"event" "agent_used_tool"- "source" "test-source"- "result" "success"- "duration_ms" nat-int?- "session_id" "00000000-0000-0000-0000-000000000002"- "event_details" {"tool_name" "get-time"}}}]- (snowplow-test/pop-event-data-and-user-id!)))))))))+ (let [events (snowplow-test/pop-event-data-and-user-id!)+ token-events (filter #(contains? (:data %) "total_tokens") events)+ tool-events (filter #(= "agent_used_tool" (get-in % [:data "event"])) events)]+ (is (=? [{:user-id (str rasta-id)+ :data {"model_id" "openrouter/test-model"+ "total_tokens" 120+ "prompt_tokens" 100+ "completion_tokens" 20+ "estimated_costs_usd" 0.0+ "duration_ms" nat-int?+ "source" "test-source"+ "tag" "test-tag"+ "session_id" "00000000-0000-0000-0000-000000000002"}}]+ token-events))+ (is (=? [{:user-id (str rasta-id)+ :data {"event" "agent_used_tool"+ "source" "test-source"+ "result" "success"+ "duration_ms" nat-int?+ "session_id" "00000000-0000-0000-0000-000000000002"+ "event_details" {"tool_name" "get-time"}}}]+ tool-events)))))))))(deftest call-llm-structured-snowplow-test(testing "fires :snowplow/token_usage event for call-llm-structured"@@ -770,14 +774,16 @@0.31024snowplow-tracking-opts)- (is (=? [{:user-id (str rasta-id)- :data {"model_id" "openrouter/test-model"- "total_tokens" 60- "prompt_tokens" 50- "completion_tokens" 10- "estimated_costs_usd" 0.0- "duration_ms" nat-int?- "source" "test-source"- "tag" "test-tag"- "session_id" "00000000-0000-0000-0000-000000000002"}}]- (snowplow-test/pop-event-data-and-user-id!)))))))))+ (let [events (snowplow-test/pop-event-data-and-user-id!)+ token-events (filter #(contains? (:data %) "total_tokens") events)]+ (is (=? [{:user-id (str rasta-id)+ :data {"model_id" "openrouter/test-model"+ "total_tokens" 60+ "prompt_tokens" 50+ "completion_tokens" 10+ "estimated_costs_usd" 0.0+ "duration_ms" nat-int?+ "source" "test-source"+ "tag" "test-tag"+ "session_id" "00000000-0000-0000-0000-000000000002"}}]+ token-events)))))))))