config: guard runtime env overrides from clobbering test config

SYMBIONT_PORT=8111 is set in the live service shell, causing runtime.exs
to override test.exs's port: 0 even under MIX_ENV=test. Wrap all env-based
overrides in a config_env() != :test guard so tests can run against the
live host without port collision.

40 tests, 0 failures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Opus 4.6 2026-05-20 06:07:08 +00:00
parent e3c445bbeb
commit cd3a136bee

View File

@ -1,5 +1,8 @@
import Config
# Skip env-based overrides in test mode so that test.exs values (port: 0,
# telepathy: disabled) are not stomped by shell env vars from the live service.
if config_env() != :test do
if port = System.get_env("SYMBIONT_PORT") do
config :symbiont, port: String.to_integer(port)
end
@ -11,3 +14,4 @@ end
if System.get_env("TELEPATHY_ENABLED") == "false" do
config :symbiont, :telepathy, enabled: false
end
end