mirror of
https://github.com/plausible/analytics.git
synced 2025-01-05 17:16:44 +03:00
Flaky test: wait till lock is acquired (#4903)
This commit is contained in:
parent
729a32e610
commit
fb2e7cda36
@ -280,7 +280,10 @@ defmodule Plausible.Ingestion.EventTest do
|
|||||||
test "drops events on session lock timeout" do
|
test "drops events on session lock timeout" do
|
||||||
site = new_site()
|
site = new_site()
|
||||||
|
|
||||||
|
test = self()
|
||||||
|
|
||||||
very_slow_buffer = fn sessions ->
|
very_slow_buffer = fn sessions ->
|
||||||
|
send(test, :slow_buffer_insert_started)
|
||||||
Process.sleep(1000)
|
Process.sleep(1000)
|
||||||
Plausible.Session.WriteBuffer.insert(sessions)
|
Plausible.Session.WriteBuffer.insert(sessions)
|
||||||
end
|
end
|
||||||
@ -310,11 +313,12 @@ defmodule Plausible.Ingestion.EventTest do
|
|||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Process.sleep(200)
|
receive do
|
||||||
|
:slow_buffer_insert_started ->
|
||||||
assert {:ok, %{buffered: [], dropped: [dropped]}} = Event.build_and_buffer(second_request)
|
assert {:ok, %{buffered: [], dropped: [dropped]}} = Event.build_and_buffer(second_request)
|
||||||
assert dropped.drop_reason == :lock_timeout
|
assert dropped.drop_reason == :lock_timeout
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
test "drops pageleave event when no session found from cache" do
|
test "drops pageleave event when no session found from cache" do
|
||||||
site = new_site()
|
site = new_site()
|
||||||
|
Loading…
Reference in New Issue
Block a user