change(logging): restrict logging.conf & add logging.test.conf

We'll override logging.conf with logging.test.conf for debug logging
needed for tests now, so we can rely on the default logging.conf
for production use.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-01-17 12:02:32 -08:00
parent cce9385fb1
commit bf4662e26f
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
4 changed files with 11 additions and 13 deletions

View file

@ -26,15 +26,13 @@ test:
- cp -v conf/config.dev conf/config - cp -v conf/config.dev conf/config
- sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config - sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config
- ./docker/test-mysql-entrypoint.sh # Create mysql AUR_CONFIG. - ./docker/test-mysql-entrypoint.sh # Create mysql AUR_CONFIG.
- make -C po all install - cp -vf logging.test.conf logging.conf # Put test logging config in place.
- make -C doc - make -C po all install # Compile translations.
- make -C test clean - make -C doc # Compile asciidoc.
- make -C test clean # Cleanup coverage.
script: script:
# Run sharness. # Run sharness.
- cp logging.conf logging.conf.bak # Copy devel logging.conf to backup
- cp logging.prod.conf logging.conf # Copy in logging.prod.conf
- make -C test sh # sharness tests use sqlite. - make -C test sh # sharness tests use sqlite.
- cp logging.conf.bak logging.conf # Restore devel logging.conf
# Run pytest. # Run pytest.
- pytest # Run pytest suites. - pytest # Run pytest suites.
- make -C test coverage # Produce coverage reports. - make -C test coverage # Produce coverage reports.

View file

@ -1,6 +1,9 @@
#!/bin/bash #!/bin/bash
set -eou pipefail set -eou pipefail
# Set test logging.
cp -vf "logging.test.conf" "logging.conf"
# We use the root user for testing in Docker. # We use the root user for testing in Docker.
# The test user must be able to create databases and drop them. # The test user must be able to create databases and drop them.
aurweb-config set database user 'root' aurweb-config set database user 'root'

View file

@ -14,9 +14,7 @@ handlers=
propogate=0 propogate=0
[logger_aurweb] [logger_aurweb]
; This loglevel is set to DEBUG for tests where we expect specific level=INFO
; debug logging to occur. In production, this should be set to INFO.
level=DEBUG
handlers=simpleHandler handlers=simpleHandler
qualname=aurweb qualname=aurweb
propagate=1 propagate=1

View file

@ -1,6 +1,3 @@
; This logger should be used in production, as it limits the logging
; done to INFO. The main logger uses DEBUG and is purely meant for
; debugging and unit tests.
[loggers] [loggers]
keys=root,aurweb,uvicorn,hypercorn,alembic keys=root,aurweb,uvicorn,hypercorn,alembic
@ -17,7 +14,9 @@ handlers=
propogate=0 propogate=0
[logger_aurweb] [logger_aurweb]
level=INFO ; This loglevel is set to DEBUG for tests where we expect specific
; debug logging to occur. In production, this should be set to INFO.
level=DEBUG
handlers=simpleHandler handlers=simpleHandler
qualname=aurweb qualname=aurweb
propagate=1 propagate=1