From bf4662e26f73891ab05a1f9d4f4273a566e0bc83 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Mon, 17 Jan 2022 12:02:32 -0800 Subject: [PATCH] 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 --- .gitlab-ci.yml | 10 ++++------ docker/test-mysql-entrypoint.sh | 3 +++ logging.conf | 4 +--- logging.prod.conf => logging.test.conf | 7 +++---- 4 files changed, 11 insertions(+), 13 deletions(-) rename logging.prod.conf => logging.test.conf (85%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e738dd1c..77271d6f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,15 +26,13 @@ test: - cp -v conf/config.dev conf/config - sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config - ./docker/test-mysql-entrypoint.sh # Create mysql AUR_CONFIG. - - make -C po all install - - make -C doc - - make -C test clean + - cp -vf logging.test.conf logging.conf # Put test logging config in place. + - make -C po all install # Compile translations. + - make -C doc # Compile asciidoc. + - make -C test clean # Cleanup coverage. script: # 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. - - cp logging.conf.bak logging.conf # Restore devel logging.conf # Run pytest. - pytest # Run pytest suites. - make -C test coverage # Produce coverage reports. diff --git a/docker/test-mysql-entrypoint.sh b/docker/test-mysql-entrypoint.sh index b3464256..5c3f1a1d 100755 --- a/docker/test-mysql-entrypoint.sh +++ b/docker/test-mysql-entrypoint.sh @@ -1,6 +1,9 @@ #!/bin/bash set -eou pipefail +# Set test logging. +cp -vf "logging.test.conf" "logging.conf" + # We use the root user for testing in Docker. # The test user must be able to create databases and drop them. aurweb-config set database user 'root' diff --git a/logging.conf b/logging.conf index 6c44f5dc..7dfd30f0 100644 --- a/logging.conf +++ b/logging.conf @@ -14,9 +14,7 @@ handlers= propogate=0 [logger_aurweb] -; 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 +level=INFO handlers=simpleHandler qualname=aurweb propagate=1 diff --git a/logging.prod.conf b/logging.test.conf similarity index 85% rename from logging.prod.conf rename to logging.test.conf index 016e7949..6c44f5dc 100644 --- a/logging.prod.conf +++ b/logging.test.conf @@ -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] keys=root,aurweb,uvicorn,hypercorn,alembic @@ -17,7 +14,9 @@ handlers= propogate=0 [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 qualname=aurweb propagate=1