test/api: Check for particular CAS version before test

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
This commit is contained in:
Rafal Stefanowski 2022-08-16 15:41:11 +02:00
parent 824e086ffb
commit 58ba99aa4a
2 changed files with 14 additions and 3 deletions

View File

@ -14,6 +14,15 @@ type: "local"
allow_disk_autoselect: False allow_disk_autoselect: False
working_dir: "/tmp/open-cas-linux/" working_dir: "/tmp/open-cas-linux/"
# CAS version to test.
# This version will be installed on DUT before test. Can be any string
# digestible by git-checkout. If not specified, by default current state
# of your controller's repo (HEAD) will be used as version to install.
# NOTE: Make sure to have a local master branch synced with upstream
# as the local repo will be taken for version reference. To do this
# simply run: `git fetch origin master:master`
cas_version: "master"
disks: disks:
- path: "/dev/device_name1" # disk device path - path: "/dev/device_name1" # disk device path
serial: "ABC" # disk serial number serial: "ABC" # disk serial number

View File

@ -275,12 +275,14 @@ def base_prepare(item):
disk.remove_partitions() disk.remove_partitions()
create_partition_table(disk, PartitionTable.gpt) create_partition_table(disk, PartitionTable.gpt)
cas_version = TestRun.config.get("cas_version") or git.get_current_commit_hash()
if get_force_param(item) and not TestRun.usr.already_updated: if get_force_param(item) and not TestRun.usr.already_updated:
installer.rsync_opencas_sources() installer.rsync_opencas_sources()
installer.reinstall_opencas() installer.reinstall_opencas(cas_version)
elif not installer.check_if_installed(): elif not installer.check_if_installed(cas_version):
installer.rsync_opencas_sources() installer.rsync_opencas_sources()
installer.set_up_opencas() installer.set_up_opencas(cas_version)
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()}")