3.3 KiB · text History 4b6fe3b
import Config

# Only in tests, remove the complexity from the password hashing algorithm
config :bcrypt_elixir, :log_rounds, 1

# Keep existing user-registration tests working — runtime.exs defaults
# to `:invite_only`, but the test suite was written against open signup.
# Tests that exercise the invite gate can `Application.put_env/3` per-test.
config :oh_my_ex_oh_ircd, :registration_mode, :open

# Don't run the ImgServ retention sweeper during tests — it would race the
# SQL sandbox. Tests call `OhMyExOhIrcd.Images.gc/0` directly instead.
config :oh_my_ex_oh_ircd, :imgserv, gc_enabled: false

# Connections don't record sightings and the pruner doesn't sweep in tests
# (the writer would race the SQL sandbox); tests that cover them enable
# them or call `OhMyExOhIrcd.Sightings` directly.
config :oh_my_ex_oh_ircd, :sightings, enabled: false, prune_enabled: false

# A static O-line so oper-command tests can `OPER testoper testpass`
# without provisioning a DB-flagged account. Hash is `testpass`.
config :oh_my_ex_oh_ircd, :opers, %{
  "testoper" => %{
    password_hash: "$2b$12$A1stkT9cNf.e0cOnjc74MuZggbXRhhYj7/iEf.z6DcYv3GTNipIMK",
    host_mask: "*@*"
  }
}

# Bind the app-level IRC listener to an ephemeral port during tests so
# `mix test` never fights with whatever's on 6667 (or a previous test run
# that leaked the socket). Real assertions all spin up their own listener
# via the IRCTestHelper, which also uses `port: 0`.
config :oh_my_ex_oh_ircd, OhMyExOhIrcd.IRC.Listener,
  port: 0,
  allow_anonymous: true,
  ping_interval_ms: 120_000,
  ping_timeout_ms: 60_000

# Move site_encrypt's internal CA off port 4002 (which Phoenix's test
# endpoint claims) so the endpoint and ACME server don't fight.
config :oh_my_ex_oh_ircd, :acme,
  client: :native,
  domains: ["localhost"],
  emails: ["admin@localhost"],
  directory_url: {:internal, [port: 4444]},
  db_folder: Path.join(System.tmp_dir!(), "oh_my_ex_oh_ircd_test_site_encrypt")

# Configure your database
#
# The MIX_TEST_PARTITION environment variable can be used
# to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information.
config :oh_my_ex_oh_ircd, OhMyExOhIrcd.Repo,
  username: "postgres",
  password: "postgres",
  hostname: "localhost",
  database: "oh_my_ex_oh_ircd_test#{System.get_env("MIX_TEST_PARTITION")}",
  pool: Ecto.Adapters.SQL.Sandbox,
  pool_size: System.schedulers_online() * 2,
  port: 54399

# We don't run a server during test. If one is required,
# you can enable the server option below.
config :oh_my_ex_oh_ircd, OhMyExOhIrcdWeb.Endpoint,
  http: [ip: {127, 0, 0, 1}, port: 4002],
  secret_key_base: "V58Yqlg29YBujOfAkxC3eFfH3b9c6nBIXxbTHqnYnrF6i3fJ3SO8Eh8+xvzLI4xt",
  server: false

# In test we don't send emails
config :oh_my_ex_oh_ircd, OhMyExOhIrcd.Mailer, adapter: Swoosh.Adapters.Test

# Disable swoosh api client as it is only required for production adapters
config :swoosh, :api_client, false

# Print only warnings and errors during test
config :logger, level: :warning

# Initialize plugs at runtime for faster test compilation
config :phoenix, :plug_init_mode, :runtime

# Enable helpful, but potentially expensive runtime checks
config :phoenix_live_view,
  enable_expensive_runtime_checks: true

# Sort query params output of verified routes for robust url comparisons
config :phoenix,
  sort_verified_routes_query_params: true