Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Fix flaky test (#3626)
hq1d161ad7667d6
diff --git a/test/plausible/session/cache_store_test.exs b/test/plausible/session/cache_store_test.exsindex 2e7eeb5a10..aa4a43798f 100644--- a/test/plausible/session/cache_store_test.exs+++ b/test/plausible/session/cache_store_test.exs@@ -118,13 +118,20 @@ defmodule Plausible.Session.CacheStoreTest doenddescribe "collapse order" do+ defp new_site_id() do+ [[site_id]] =+ Plausible.ClickhouseRepo.query!("select max(site_id) + rand() from sessions_v2 FINAL").rows++ site_id+ end+defp flush(events) dofor e <- events, do: CacheStore.on_event(e, nil)Plausible.Session.WriteBuffer.flush()endtest "across parts" do- e = build(:event, name: "pageview")+ e = build(:event, name: "pageview", site_id: new_site_id())flush([%{e | pathname: "/"}])flush([%{e | pathname: "/exit"}])@@ -138,7 +145,7 @@ defmodule Plausible.Session.CacheStoreTest doendtest "within parts" do- e = build(:event, name: "pageview")+ e = build(:event, name: "pageview", site_id: new_site_id())flush([%{e | pathname: "/"},@@ -154,7 +161,7 @@ defmodule Plausible.Session.CacheStoreTest doendtest "across and within parts" do- e = build(:event, name: "pageview")+ e = build(:event, name: "pageview", site_id: new_site_id())flush([%{e | pathname: "/"},