test api: split installer into smaller steps
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
3f8f033c4c
commit
ce84b811b7
@ -8,12 +8,13 @@ import logging
|
|||||||
|
|
||||||
from tests import conftest
|
from tests import conftest
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
|
from api.cas import git
|
||||||
from api.cas import cas_module
|
from api.cas import cas_module
|
||||||
from test_utils import os_utils
|
from test_utils import os_utils
|
||||||
from test_utils.output import CmdException
|
from test_utils.output import CmdException
|
||||||
|
|
||||||
|
|
||||||
def install_opencas():
|
def rsync_opencas_sources():
|
||||||
TestRun.LOGGER.info("Copying Open CAS repository to DUT")
|
TestRun.LOGGER.info("Copying Open CAS repository to DUT")
|
||||||
TestRun.executor.rsync_to(
|
TestRun.executor.rsync_to(
|
||||||
f"{TestRun.usr.repo_dir}/",
|
f"{TestRun.usr.repo_dir}/",
|
||||||
@ -31,8 +32,7 @@ def _clean_opencas_repo():
|
|||||||
raise CmdException("make distclean command executed with nonzero status", output)
|
raise CmdException("make distclean command executed with nonzero status", output)
|
||||||
|
|
||||||
|
|
||||||
def install_opencas():
|
def build_opencas():
|
||||||
_clean_opencas_repo()
|
|
||||||
TestRun.LOGGER.info("Building Open CAS")
|
TestRun.LOGGER.info("Building Open CAS")
|
||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
f"cd {TestRun.usr.working_dir} && "
|
f"cd {TestRun.usr.working_dir} && "
|
||||||
@ -41,6 +41,8 @@ def install_opencas():
|
|||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise CmdException("Make command executed with nonzero status", output)
|
raise CmdException("Make command executed with nonzero status", output)
|
||||||
|
|
||||||
|
|
||||||
|
def install_opencas():
|
||||||
TestRun.LOGGER.info("Installing Open CAS")
|
TestRun.LOGGER.info("Installing Open CAS")
|
||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
f"cd {TestRun.usr.working_dir} && "
|
f"cd {TestRun.usr.working_dir} && "
|
||||||
@ -56,6 +58,19 @@ def install_opencas():
|
|||||||
TestRun.LOGGER.info(output.stdout)
|
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():
|
def uninstall_opencas():
|
||||||
TestRun.LOGGER.info("Uninstalling Open CAS")
|
TestRun.LOGGER.info("Uninstalling Open CAS")
|
||||||
output = TestRun.executor.run("casadm -V")
|
output = TestRun.executor.run("casadm -V")
|
||||||
@ -72,7 +87,7 @@ def uninstall_opencas():
|
|||||||
def reinstall_opencas():
|
def reinstall_opencas():
|
||||||
if check_if_installed():
|
if check_if_installed():
|
||||||
uninstall_opencas()
|
uninstall_opencas()
|
||||||
install_opencas()
|
set_up_opencas()
|
||||||
|
|
||||||
|
|
||||||
def check_if_installed():
|
def check_if_installed():
|
||||||
|
@ -174,7 +174,7 @@ def base_prepare(item):
|
|||||||
if get_force_param(item) and not TestRun.usr.already_updated:
|
if get_force_param(item) and not TestRun.usr.already_updated:
|
||||||
installer.reinstall_opencas()
|
installer.reinstall_opencas()
|
||||||
elif not installer.check_if_installed():
|
elif not installer.check_if_installed():
|
||||||
installer.install_opencas()
|
installer.set_up_opencas()
|
||||||
TestRun.usr.already_updated = True
|
TestRun.usr.already_updated = True
|
||||||
TestRun.LOGGER.add_build_info(f'Commit hash:')
|
TestRun.LOGGER.add_build_info(f'Commit hash:')
|
||||||
TestRun.LOGGER.add_build_info(f"{git.get_current_commit_hash()}")
|
TestRun.LOGGER.add_build_info(f"{git.get_current_commit_hash()}")
|
||||||
|
Loading…
Reference in New Issue
Block a user