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

View File

@@ -1,7 +1,7 @@
# Mode # Mode
# The following modes can be combined with each other # 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_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_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. 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 %} {% else %}
--letsencrypt-webroot-path "{{ LETSENCRYPT_WEBROOT_PATH }}" --letsencrypt-webroot-path "{{ LETSENCRYPT_WEBROOT_PATH }}"
{% endif %} {% endif %}
{{ '--mode-test' if MODE_TEST | bool else '' }} {{ '--mode-test' if MODE_DUMMY | bool else '' }}
register: certbundle_result register: certbundle_result
changed_when: > changed_when: >
('certificate not yet due for renewal' not in (certbundle_result.stdout | lower | default(''))) ('certificate not yet due for renewal' not in (certbundle_result.stdout | lower | default('')))