Skip to content

Commit

Permalink
configurable logging in test env
Browse files Browse the repository at this point in the history
  • Loading branch information
mayel committed Feb 13, 2024
1 parent dfb497f commit b615257
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
POSTGRES_HOST: postgres
POSTGRES_PASSWORD: postgres
CI: true
TEST_LOG_TRUNCATE: 340
TEST_LOG_LEVEL: error
SECRET_KEY_BASE: "kSNSvYkWk14onNdbYzhEqFyG5TzpOO9+FFlk5sIrhTk0RV6+FeL/nM8DWQffDah4woepgQdrP6J8cjWGyehcWcRWvIIWXsghp0yY9/fEjgfUekD15P9LGRCmu6exIQ6g"
SIGNING_SALT: "NPkqpeTx/q9xGQRWwRpqBWI7bCxeHMAF4L2PHntfjVtd8GZD2BQKe9KLnkIR5WbLVdZt24FWuR+Hy5WoXaZM4APydGvC2+w2enJmskOckX5VY1Bpvm7JGKu+QymgIgK/"
ENCRYPTION_SALT: "l+QT/gkdX722f57qSAUc+bZcqm5ZduXY4D0hp0glEiKdR267JsZ1/CZlrlhADcD8kzuaZGFWvJ2dlr6sujbzGQV5e04lKVIsZh3gfd8eqQBckIqH6L8TDRRz4M07YE+F"
Expand Down Expand Up @@ -84,8 +86,8 @@ jobs:
run: mix bonfire.deps.update
- name: Fetch any differences in nested deps (+ run post-install setup)
run: just deps-get && just pre-init
- name: Clean-build Bonfire data extensions
run: mix bonfire.deps.clean.data
# - name: Clean-build Bonfire data extensions
# run: mix bonfire.deps.clean.data
- name: Compile deps & app
run: mix compile
- name: Set up database
Expand Down
12 changes: 9 additions & 3 deletions flavours/classic/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ config :bonfire_search,

## Other general test config

truncate = case System.get_env("TEST_LOG_TRUNCATE", "1000") do
"0" -> :infinity
truncate -> String.to_integer(truncate)
end

config :logger,
level: :error,
truncate: :infinity
level: String.to_existing_atom(System.get_env("TEST_LOG_LEVEL", "info")),
truncate: truncate

config :logger, :console, truncate: truncate

if !test_instance? do
# to supress non-captured logs in tests (eg. in setup_all)
config :logger, backends: []
end

config :logger, :console, truncate: :infinity

# Configure your database
# db = "bonfire_test#{System.get_env("MIX_TEST_PARTITION")}"
Expand Down

0 comments on commit b615257

Please sign in to comment.