Solved testing mode bug

This commit is contained in:
2025-09-19 11:18:29 +02:00
parent a10ba78a5a
commit 61772d5916
3 changed files with 12 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ def run_ansible_playbook(
password_file=None,
verbose=0,
skip_build=False,
skip_tests=False,
logs=False
):
start_time = datetime.datetime.now()
@@ -56,9 +57,8 @@ def run_ansible_playbook(
except subprocess.CalledProcessError:
print("\n❌ Inventory validation failed. Deployment aborted.\n", file=sys.stderr)
sys.exit(1)
# Tests are controlled via MODE_TEST
if modes.get("MODE_TEST", False):
if not skip_tests:
print("\n🧪 Running tests (make messy-test)...\n")
subprocess.run(["make", "messy-test"], check=True)
@@ -255,6 +255,12 @@ def main():
action="store_true",
help="Skip running 'make build' before deployment.",
)
parser.add_argument(
"-t",
"--skip-tests",
action="store_true",
help="Skip running 'make messy-tests' before deployment.",
)
parser.add_argument(
"-i",
"--id",
@@ -301,6 +307,7 @@ def main():
password_file=args.password_file,
verbose=args.verbose,
skip_build=args.skip_build,
skip_tests=args.skip_tests,
logs=args.logs,
)

View File

@@ -1,7 +1,7 @@
# Mode
# The following modes can be combined with each other
MODE_TEST: false # Executes test routines instead of productive routines
MODE_DUMMY: false # Executes dummy/test routines instead of productive routines
MODE_UPDATE: true # Executes updates
MODE_DEBUG: false # This enables debugging in ansible and in the apps, You SHOULD NOT enable this on production servers
MODE_RESET: false # Cleans up all Infinito.Nexus files. It's necessary to run to whole playbook and not particial roles when using this function.

View File

@@ -18,7 +18,7 @@
{% else %}
--letsencrypt-webroot-path "{{ LETSENCRYPT_WEBROOT_PATH }}"
{% endif %}
{{ '--mode-test' if MODE_TEST | bool else '' }}
{{ '--mode-test' if MODE_DUMMY | bool else '' }}
register: certbundle_result
changed_when: >
('certificate not yet due for renewal' not in (certbundle_result.stdout | lower | default('')))