Fix CI test failures and configuration issues
- Simplify APRS_PORT parsing to avoid syntax errors - Disable Exq properly in test environment to prevent startup issues - Disable Prometheus telemetry in test mode to avoid port conflicts - Update telemetry module to conditionally start Prometheus metrics 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f8e075319e
commit
6fdd39dc0e
3 changed files with 24 additions and 17 deletions
|
|
@ -172,14 +172,7 @@ if config_env() == :prod do
|
|||
ecto_repos: [Aprsme.Repo],
|
||||
aprs_is_server: System.get_env("APRS_SERVER", "dallas.aprs2.net"),
|
||||
# config :aprsme, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
|
||||
aprs_is_port: case System.get_env("APRS_PORT", "14580") do
|
||||
port when is_binary(port) ->
|
||||
case Integer.parse(port) do
|
||||
{int, ""} -> int
|
||||
_ -> 14580 # fallback to default port if parsing fails
|
||||
end
|
||||
_ -> 14580
|
||||
end,
|
||||
aprs_is_port: String.to_integer(System.get_env("APRS_PORT") || "14580"),
|
||||
aprs_is_default_filter: System.get_env("APRS_FILTER"),
|
||||
aprs_is_login_id: System.get_env("APRS_CALLSIGN"),
|
||||
aprs_is_password: System.get_env("APRS_PASSCODE"),
|
||||
|
|
|
|||
|
|
@ -52,7 +52,13 @@ config :aprsme, auto_migrate: false
|
|||
config :bcrypt_elixir, :log_rounds, 1
|
||||
|
||||
# Disable Exq during tests to prevent background job execution
|
||||
config :exq, mode: :inline
|
||||
config :exq,
|
||||
start_on_application: false,
|
||||
mode: :inline
|
||||
|
||||
# Disable Prometheus telemetry in test mode to avoid port conflicts
|
||||
config :aprsme, AprsmeWeb.Telemetry,
|
||||
enabled: false
|
||||
|
||||
# Configure ExVCR
|
||||
config :exvcr,
|
||||
|
|
|
|||
|
|
@ -10,14 +10,22 @@ defmodule AprsmeWeb.Telemetry do
|
|||
|
||||
@impl true
|
||||
def init(_arg) do
|
||||
children = [
|
||||
# Telemetry poller will execute the given period measurements
|
||||
# every 10_000ms. Learn more here: https://hexdocs.pm/telemetry_metrics
|
||||
{:telemetry_poller, measurements: periodic_measurements(), period: 10_000},
|
||||
# Add reporters as children of your supervision tree.
|
||||
# {Telemetry.Metrics.ConsoleReporter, metrics: metrics()}
|
||||
{TelemetryMetricsPrometheus, [metrics: metrics()]}
|
||||
]
|
||||
children =
|
||||
if Application.get_env(:aprsme, AprsmeWeb.Telemetry)[:enabled] != false do
|
||||
[
|
||||
# Telemetry poller will execute the given period measurements
|
||||
# every 10_000ms. Learn more here: https://hexdocs.pm/telemetry_metrics
|
||||
{:telemetry_poller, measurements: periodic_measurements(), period: 10_000},
|
||||
# Add reporters as children of your supervision tree.
|
||||
# {Telemetry.Metrics.ConsoleReporter, metrics: metrics()}
|
||||
{TelemetryMetricsPrometheus, [metrics: metrics()]}
|
||||
]
|
||||
else
|
||||
[
|
||||
# Only telemetry poller in test mode
|
||||
{:telemetry_poller, measurements: periodic_measurements(), period: 10_000}
|
||||
]
|
||||
end
|
||||
|
||||
Supervisor.init(children, strategy: :one_for_one)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue