Skip to content

Commit 199a1f0

Browse files
Add upgrade_test marker detection and conditionally select testing repo in pool_with_linstor
This mechanism allows the test to start with our without testing repo packages Signed-off-by: Rushikesh Jadhav <[email protected]>
1 parent ae48061 commit 199a1f0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/storage/linstor/conftest.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,20 @@ def storage_pool_name(provisioning_type):
4949
def provisioning_type(request):
5050
return request.param
5151

52+
def pytest_configure(config):
53+
config._linstor_upgrade_test = False
54+
55+
def pytest_collection_modifyitems(config, items):
56+
for item in items:
57+
if item.get_closest_marker("upgrade_test"):
58+
config._linstor_upgrade_test = True
59+
break
60+
5261
@pytest.fixture(scope='package')
53-
def pool_with_linstor(hostA2, lvm_disks, pool_with_saved_yum_state):
62+
def pool_with_linstor(hostA2, lvm_disks, pool_with_saved_yum_state, request):
5463
import concurrent.futures
64+
65+
dont_use_testing_repo = request.config._linstor_upgrade_test
5566
pool = pool_with_saved_yum_state
5667

5768
def check_linstor_installed(host):
@@ -66,7 +77,10 @@ def check_linstor_installed(host):
6677
def install_linstor(host):
6778
logging.info(f"Installing {LINSTOR_PACKAGE} on host {host}...")
6879
host.yum_install([LINSTOR_RELEASE_PACKAGE])
69-
host.yum_install([LINSTOR_PACKAGE], enablerepo="xcp-ng-linstor-testing")
80+
if dont_use_testing_repo:
81+
host.yum_install([LINSTOR_PACKAGE])
82+
else:
83+
host.yum_install([LINSTOR_PACKAGE], enablerepo="xcp-ng-linstor-testing")
7084
# Needed because the linstor driver is not in the xapi sm-plugins list
7185
# before installing the LINSTOR packages.
7286
host.ssh(["systemctl", "restart", "multipathd"])

0 commit comments

Comments
 (0)