@@ -105,13 +105,19 @@ def storage_pool_name(provisioning_type: str) -> str:
105105def provisioning_type (request : pytest .FixtureRequest ) -> str :
106106 return request .param
107107
108+ _linstor_upgrade_test = False
109+
110+ # pytest hook: called once at startup, before test collection.
108111def pytest_configure (config ):
109- config ._linstor_upgrade_test = False
112+ global _linstor_upgrade_test
113+ _linstor_upgrade_test = False
110114
115+ # pytest hook: called after all tests are collected, before any test runs.
111116def pytest_collection_modifyitems (config , items ):
117+ global _linstor_upgrade_test
112118 for item in items :
113119 if item .get_closest_marker ("upgrade_test" ):
114- config . _linstor_upgrade_test = True
120+ _linstor_upgrade_test = True
115121 break
116122
117123@pytest .fixture (scope = 'package' )
@@ -120,11 +126,9 @@ def pool_with_linstor(
120126 lvm_disks : None ,
121127 pool_with_saved_yum_state : Pool ,
122128 _linstor_config : LinstorConfig ,
123- request
124129) -> Generator [Pool , None , None ]:
125130 import concurrent .futures
126131
127- dont_use_testing_repo = request .config ._linstor_upgrade_test
128132 pool = pool_with_saved_yum_state
129133
130134 def check_linstor_installed (host : Host ) -> None :
@@ -139,10 +143,10 @@ def check_linstor_installed(host: Host) -> None:
139143 def install_linstor (host : Host ) -> None :
140144 logging .info (f"Installing { LINSTOR_PACKAGE } on host { host } ..." )
141145 host .yum_install ([LINSTOR_RELEASE_PACKAGE ])
142- if dont_use_testing_repo :
143- host .yum_install ([LINSTOR_PACKAGE ])
144- else :
146+ if _linstor_upgrade_test :
145147 host .yum_install ([LINSTOR_PACKAGE ], enablerepo = "xcp-ng-linstor-testing" )
148+ else :
149+ host .yum_install ([LINSTOR_PACKAGE ])
146150 # Needed because the linstor driver is not in the xapi sm-plugins list
147151 # before installing the LINSTOR packages.
148152 host .ssh ('systemctl restart multipathd' )
0 commit comments