diff --git a/test/functional/api/cas/installer.py b/test/functional/api/cas/installer.py index a709e16..8731b13 100644 --- a/test/functional/api/cas/installer.py +++ b/test/functional/api/cas/installer.py @@ -8,12 +8,13 @@ import logging from tests import conftest from core.test_run import TestRun +from api.cas import git from api.cas import cas_module from test_utils import os_utils from test_utils.output import CmdException -def install_opencas(): +def rsync_opencas_sources(): TestRun.LOGGER.info("Copying Open CAS repository to DUT") TestRun.executor.rsync_to( f"{TestRun.usr.repo_dir}/", @@ -31,8 +32,7 @@ def _clean_opencas_repo(): raise CmdException("make distclean command executed with nonzero status", output) -def install_opencas(): - _clean_opencas_repo() +def build_opencas(): TestRun.LOGGER.info("Building Open CAS") output = TestRun.executor.run( f"cd {TestRun.usr.working_dir} && " @@ -41,6 +41,8 @@ def install_opencas(): if output.exit_code != 0: raise CmdException("Make command executed with nonzero status", output) + +def install_opencas(): TestRun.LOGGER.info("Installing Open CAS") output = TestRun.executor.run( f"cd {TestRun.usr.working_dir} && " @@ -56,6 +58,19 @@ def install_opencas(): TestRun.LOGGER.info(output.stdout) +def set_up_opencas(): + rsync_opencas_sources() + + _clean_opencas_repo() + + if version: + git.checkout_cas_version() + + build_opencas() + + install_opencas() + + def uninstall_opencas(): TestRun.LOGGER.info("Uninstalling Open CAS") output = TestRun.executor.run("casadm -V") @@ -72,7 +87,7 @@ def uninstall_opencas(): def reinstall_opencas(): if check_if_installed(): uninstall_opencas() - install_opencas() + set_up_opencas() def check_if_installed(): diff --git a/test/functional/tests/conftest.py b/test/functional/tests/conftest.py index 7728e85..757d122 100644 --- a/test/functional/tests/conftest.py +++ b/test/functional/tests/conftest.py @@ -174,7 +174,7 @@ def base_prepare(item): if get_force_param(item) and not TestRun.usr.already_updated: installer.reinstall_opencas() elif not installer.check_if_installed(): - installer.install_opencas() + installer.set_up_opencas() TestRun.usr.already_updated = True TestRun.LOGGER.add_build_info(f'Commit hash:') TestRun.LOGGER.add_build_info(f"{git.get_current_commit_hash()}")