fix: Resolve GenServer errors in tests

- Fix invalid CSS selector in user registration test by replacing
  `fl-contains` with proper href attribute selector
- Disable telemetry database metrics collection in test environment
  to prevent database ownership errors from telemetry poller

This eliminates the GenServer termination errors that were occurring
during test runs due to invalid CSS selectors and database access
issues in background telemetry processes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Graham McIntire 2025-07-30 14:33:11 -05:00
parent 1fc554eb5f
commit 7b5395c638
No known key found for this signature in database
2 changed files with 10 additions and 1 deletions

View file

@ -125,6 +125,15 @@ defmodule Aprsme.Telemetry.DatabaseMetrics do
end
def collect_postgres_metrics do
# Skip database metrics collection in test environment
if Application.get_env(:aprsme, :env) == :test do
:ok
else
do_collect_postgres_metrics()
end
end
defp do_collect_postgres_metrics do
# Database size
case Aprsme.Repo.query("SELECT pg_database_size(current_database()) as size") do
{:ok, %{rows: [[size]]}} ->

View file

@ -77,7 +77,7 @@ defmodule AprsmeWeb.UserRegistrationLiveTest do
{:ok, _login_live, login_html} =
lv
|> element(~s|main a:fl-contains("Sign in")|)
|> element(~s|main a[href="/users/log_in"]|)
|> render_click()
|> follow_redirect(conn, ~p"/users/log_in")