-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: Attempt to fix some flaky Elixir unit tests #4927
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ defmodule Domain.Mocks.OpenIDConnect do | |
|
||
Bypass.stub(bypass, "GET", "/.well-known/openid-configuration", fn conn -> | ||
conn = fetch_conn_params(conn) | ||
send(test_pid, {:request, conn}) | ||
|
||
attrs = %{ | ||
"issuer" => "#{endpoint}/", | ||
|
@@ -91,7 +90,13 @@ defmodule Domain.Mocks.OpenIDConnect do | |
"request_parameter_supported" => false | ||
} | ||
|
||
Plug.Conn.resp(conn, 200, Jason.encode!(attrs)) | ||
# Process may not be alive in slow CI environments | ||
if Process.alive?(test_pid) do | ||
send(test_pid, {:request, conn}) | ||
Plug.Conn.resp(conn, 200, Jason.encode!(attrs)) | ||
else | ||
Plug.Conn.resp(conn, 503, "") | ||
end | ||
end) | ||
|
||
bypass | ||
|
@@ -102,8 +107,14 @@ defmodule Domain.Mocks.OpenIDConnect do | |
|
||
Bypass.expect(bypass, "POST", "/oauth/token", fn conn -> | ||
conn = fetch_conn_params(conn) | ||
send(test_pid, {:request, conn}) | ||
Plug.Conn.resp(conn, 200, Jason.encode!(attrs)) | ||
|
||
# Process may not be alive in slow CI environments | ||
if Process.alive?(test_pid) do | ||
send(test_pid, {:request, conn}) | ||
Plug.Conn.resp(conn, 200, Jason.encode!(attrs)) | ||
else | ||
Plug.Conn.resp(conn, 503, "") | ||
end | ||
end) | ||
|
||
bypass | ||
|
@@ -114,8 +125,14 @@ defmodule Domain.Mocks.OpenIDConnect do | |
|
||
Bypass.expect(bypass, "POST", "/oauth/token", fn conn -> | ||
conn = fetch_conn_params(conn) | ||
send(test_pid, {:request, conn}) | ||
Plug.Conn.resp(conn, 401, Jason.encode!(attrs)) | ||
|
||
# Process may not be alive in slow CI environments | ||
if Process.alive?(test_pid) do | ||
send(test_pid, {:request, conn}) | ||
Plug.Conn.resp(conn, 401, Jason.encode!(attrs)) | ||
else | ||
Plug.Conn.resp(conn, 503, "") | ||
end | ||
end) | ||
|
||
bypass | ||
|
@@ -142,8 +159,14 @@ defmodule Domain.Mocks.OpenIDConnect do | |
) | ||
|
||
conn = fetch_conn_params(conn) | ||
send(test_pid, {:request, conn}) | ||
Plug.Conn.resp(conn, 200, Jason.encode!(attrs)) | ||
|
||
# Process may not be alive in slow CI environments | ||
if Process.alive?(test_pid) do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't fix anything, the issue happens when Plug process is trying to read from Bypass process. So when the Plug process is terminated with the test process, the bypass can't finish reading the full response. And it doesn't matter if the response code is 503 or 401, has body or not, etc. |
||
send(test_pid, {:request, conn}) | ||
Plug.Conn.resp(conn, 200, Jason.encode!(attrs)) | ||
else | ||
Plug.Conn.resp(conn, 503, "") | ||
end | ||
end) | ||
|
||
bypass | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,7 +134,8 @@ defmodule Web.AcceptanceCase do | |
if env = System.get_env("E2E_DEFAULT_WAIT_SECONDS") do | ||
String.to_integer(env) | ||
else | ||
2 | ||
# GitHub shared runners can be very slow during peak hours | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jamilbk it's already 5 seconds on CI: E2E_DEFAULT_WAIT_SECONDS in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😢 |
||
5 | ||
end | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/firezone/firezone/actions/runs/8907610107/job/24461787301?pr=4843