Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Flaky test fix omnibus (#6496)

Artur Patabaa9c2f2ece3
diff --git a/lib/plausible/sites/index.ex b/lib/plausible/sites/index.ex
index 943c8f6966..191e70775a 100644
--- a/lib/plausible/sites/index.ex
+++ b/lib/plausible/sites/index.ex
@@ -31,7 +31,7 @@ defmodule Plausible.Sites.Index do
defmodule Page do
@moduledoc """
- A single page of results, drop-in replacement for Scrivener.Page
+ A single page of results, drop-in replacement for Scrivener.Page
"""
@type t() :: %__MODULE__{
diff --git a/test/plausible/sites/index_test.exs b/test/plausible/sites/index_test.exs
index bb53a57f12..15f24ab954 100644
--- a/test/plausible/sites/index_test.exs
+++ b/test/plausible/sites/index_test.exs
@@ -41,7 +41,8 @@ defmodule Plausible.Sites.IndexTest do
team = Plausible.Teams.complete_setup(team)
- assert Index.fetch_site_ids(user, team: team) == [regular1.id, regular2.id]
+ assert Enum.sort(Index.fetch_site_ids(user, team: team)) ==
+ Enum.sort([regular1.id, regular2.id])
end
end
diff --git a/test/support/factory.ex b/test/support/factory.ex
index a70c8f9b9b..6e2fa3a490 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -113,7 +113,7 @@ defmodule Plausible.Factory do
session_id: SipHash.hash!(hash_key(), Ecto.UUID.generate()),
user_id: SipHash.hash!(hash_key(), Ecto.UUID.generate()),
hostname: hostname,
- site_id: Enum.random(1000..10_000),
+ site_id: Enum.random(1_000_000_000..2_000_000_000),
entry_page: "/",
pageviews: 1,
events: 1,
@@ -140,7 +140,7 @@ defmodule Plausible.Factory do
event = %Plausible.ClickhouseEventV2{
hostname: hostname,
- site_id: Enum.random(1000..10_000),
+ site_id: Enum.random(1_000_000_000..2_000_000_000),
pathname: "/",
timestamp: NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second),
user_id: SipHash.hash!(hash_key(), Ecto.UUID.generate()),