@@ -108,13 +108,19 @@ def storage_pool_name(provisioning_type: str) -> str:
108108def provisioning_type (request : pytest .FixtureRequest ) -> str :
109109 return request .param
110110
111+ _linstor_upgrade_test = False
112+
113+ # pytest hook: called once at startup, before test collection.
111114def pytest_configure (config ):
112- config ._linstor_upgrade_test = False
115+ global _linstor_upgrade_test
116+ _linstor_upgrade_test = False
113117
118+ # pytest hook: called after all tests are collected, before any test runs.
114119def pytest_collection_modifyitems (config , items ):
120+ global _linstor_upgrade_test
115121 for item in items :
116122 if item .get_closest_marker ("upgrade_test" ):
117- config . _linstor_upgrade_test = True
123+ _linstor_upgrade_test = True
118124 break
119125
120126@pytest .fixture (scope = 'package' )
@@ -123,11 +129,9 @@ def pool_with_linstor(
123129 lvm_disks : None ,
124130 pool_with_saved_yum_state : Pool ,
125131 _linstor_config : LinstorConfig ,
126- request
127132) -> Generator [Pool , None , None ]:
128133 import concurrent .futures
129134
130- dont_use_testing_repo = request .config ._linstor_upgrade_test
131135 pool = pool_with_saved_yum_state
132136
133137 def check_linstor_installed (host : Host ) -> None :
@@ -142,10 +146,10 @@ def check_linstor_installed(host: Host) -> None:
142146 def install_linstor (host : Host ) -> None :
143147 logging .info (f"Installing { LINSTOR_PACKAGE } on host { host } ..." )
144148 host .yum_install ([LINSTOR_RELEASE_PACKAGE ])
145- if dont_use_testing_repo :
146- host .yum_install ([LINSTOR_PACKAGE ])
147- else :
149+ if _linstor_upgrade_test :
148150 host .yum_install ([LINSTOR_PACKAGE ], enablerepo = "xcp-ng-linstor-testing" )
151+ else :
152+ host .yum_install ([LINSTOR_PACKAGE ])
149153 # Needed because the linstor driver is not in the xapi sm-plugins list
150154 # before installing the LINSTOR packages.
151155 host .ssh ('systemctl restart multipathd' )
0 commit comments