Skip to content

Commit

Permalink
test_update: Avoid updating config after site update
Browse files Browse the repository at this point in the history
The site-update process includes config-update as well.
There is no need to force a config-update again afterwards.

Change-Id: I30dc88f2bcaf0286d1f7d28c9fd3bd79b1f1f509
  • Loading branch information
MatteoStifano committed Jan 26, 2024
1 parent 3592276 commit d01e171
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
19 changes: 0 additions & 19 deletions tests/update/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,6 @@ def get_site_status(site: Site) -> str | None:
return None


def update_config(site: Site) -> int:
"""Run cmk-update-config and check the result.
If merging the config worked fine, return 0.
If merging the config was not possible, use installation defaults and return 1.
If any other error occurred, return 2.
"""
for rc, conflict_mode in enumerate(("abort", "install")):
cmd = [f"{site.root}/bin/cmk-update-config", "-v", f"--conflict={conflict_mode}"]
process = site.execute(cmd, stdout=subprocess.PIPE)
stdout, _ = process.communicate()
rc = process.returncode
if rc == 0:
logger.debug(stdout)
return rc
logger.error(stdout)
return 2


def _get_site(version: CMKVersion, interactive: bool, base_site: Site | None = None) -> Site:
"""Install or update the test site with the given version.
Expand Down
7 changes: 1 addition & 6 deletions tests/update/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from cmk.utils.hostaddress import HostName
from cmk.utils.version import Edition

from .conftest import get_site_status, update_config, update_site
from .conftest import get_site_status, update_site

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -93,11 +93,6 @@ def test_update( # pylint: disable=too-many-branches

target_site = update_site(test_site, target_version, not disable_interactive_mode)

# Triggering cmk config update
update_config_result = update_config(target_site)

assert update_config_result == 0, "Updating the configuration failed unexpectedly!"

# get the service status codes and check them
assert get_site_status(target_site) == "running", "Invalid service status after updating!"

Expand Down

0 comments on commit d01e171

Please sign in to comment.