]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Initialize all environment variables when running isctest
authorNicki Křížek <nicki@isc.org>
Fri, 10 May 2024 11:10:14 +0000 (13:10 +0200)
committerNicki Křížek <nicki@isc.org>
Mon, 5 Aug 2024 15:54:11 +0000 (17:54 +0200)
Ensure all the variables are initialized when running the main function
of isctest module. This enables proper environment variables during test
script development when only conf.sh is sourced, rather than the script
being executed by the pytest runner.

(cherry picked from commit d7ace928b5e9520b0b68169abef43be3f6d50a0c)

bin/tests/system/isctest/__main__.py
bin/tests/system/isctest/log/basic.py
bin/tests/system/isctest/vars/algorithms.py

index 2b82a81d465c826d37cefd984d9488d6a24db3ac..d1be74c7272b4b25fa26fd2b1dfbc3a66c207284 100644 (file)
@@ -9,9 +9,16 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-from .vars import ALL
+import logging
+
+from . import log
+from .vars import ALL, init_vars
 
 
 if __name__ == "__main__":
+    # use root logger as fallback - we're not interested in proper logs here
+    log.basic.LOGGERS["conftest"] = logging.getLogger()
+
+    init_vars()
     for name, value in ALL.items():
         print(f"export {name}={value}")
index b3987b27f95faa5e7bb94d6b475c7559be2c012a..67121d2e24b4947a4a9d6c3bdd08041adabeccd8 100644 (file)
@@ -14,7 +14,6 @@ from pathlib import Path
 from typing import Dict, Optional
 
 
-CONFTEST_LOGGER = logging.getLogger("conftest")
 LOG_FORMAT = "%(asctime)s %(levelname)7s:%(name)s  %(message)s"
 
 LOGGERS = {
index 56f3edc62cb9e58fd5404002ce91ec09cfb9f5b2..26bcc579f8bc36ca24ac4c034f552bc5b06f01de 100644 (file)
@@ -129,9 +129,11 @@ def is_crypto_supported(alg: Algorithm) -> bool:
             cwd=tmpdir,
             check=False,
             stdout=subprocess.DEVNULL,
+            stderr=subprocess.PIPE,
         )
         if proc.returncode == 0:
             return True
+        log.debug(f"dnssec-keygen stderr: {proc.stderr.decode('utf-8')}")
         log.info("algorithm %s not supported", alg.name)
         return False