mirror of
https://github.com/certbot/certbot.git
synced 2026-06-05 23:04:39 -04:00
As discussed in #7539, we need proper tests of the Windows installer itself in order to variety that all the logic contained in a production-grade runtime of Certbot on Windows is correctly setup by each version of the installer, and so for a variety of Windows OSes. This PR handles this requirement. The new `windows_installer_integration_tests` module in `certbot-ci` will: * run the given Windows installer * check that Certbot is properly installed and working * check that the scheduled renew task is set up * check that the scheduled task actually launch the Certbot renew logic The Windows nightly tests are updated accordingly, in order to have the tests run on Windows Server 2012R2, 2016 and 2019. These tests will evolve as we add more logic on the installer. * Configure an integration test testing the windows installer * Write the test module * Configurable installer path, prepare azure pipelines * Fix option * Update test_main.py * Add confirmation for this destructive test * Use regex to validate certbot --version output * Explicit dependency on a log output * Use an exception to ask confirmation * Use --allow-persistent-changes
38 lines
1.7 KiB
Python
38 lines
1.7 KiB
Python
"""
|
|
General conftest for pytest execution of all integration tests lying
|
|
in the window_installer_integration tests package.
|
|
As stated by pytest documentation, conftest module is used to set on
|
|
for a directory a specific configuration using built-in pytest hooks.
|
|
|
|
See https://docs.pytest.org/en/latest/reference.html#hook-reference
|
|
"""
|
|
from __future__ import print_function
|
|
import os
|
|
|
|
import pytest
|
|
|
|
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
|
|
|
|
|
def pytest_addoption(parser):
|
|
"""
|
|
Standard pytest hook to add options to the pytest parser.
|
|
:param parser: current pytest parser that will be used on the CLI
|
|
"""
|
|
parser.addoption('--installer-path',
|
|
default=os.path.join(ROOT_PATH, 'windows-installer', 'build',
|
|
'nsis', 'certbot-beta-installer-win32.exe'),
|
|
help='set the path of the windows installer to use, default to '
|
|
'CERTBOT_ROOT_PATH\\windows-installer\\build\\nsis\\certbot-beta-installer-win32.exe')
|
|
parser.addoption('--allow-persistent-changes', action='store_true',
|
|
help='needs to be set, and confirm that the test will make persistent changes on this machine')
|
|
|
|
|
|
def pytest_configure(config):
|
|
"""
|
|
Standard pytest hook used to add a configuration logic for each node of a pytest run.
|
|
:param config: the current pytest configuration
|
|
"""
|
|
if not config.option.allow_persistent_changes:
|
|
raise RuntimeError('This integration test would install Certbot on your machine. '
|
|
'Please run it again with the `--allow-persistent-changes` flag set to acknowledge.')
|