77
88from lib .commands import SSHCommandFailed
99from lib .common import vm_image , wait_for
10+ from lib .host import Host
1011from lib .sr import SR
1112from lib .vdi import VDI
1213from lib .vm import VM
2021 xva_export_import ,
2122)
2223
23- from typing import TYPE_CHECKING
24-
25- if TYPE_CHECKING :
26- from lib .host import Host
27- from lib .vdi import VDI
28-
2924from .conftest import POOL_NAME , POOL_PATH
3025
3126# Requirements:
@@ -72,13 +67,13 @@ def test_create_and_destroy_sr(self, host: Host, image_format: ImageFormat) -> N
7267@pytest .mark .usefixtures ("zpool_vol0" )
7368class TestZFSSR :
7469 @pytest .mark .quicktest
75- def test_quicktest (self , zfs_sr ) :
70+ def test_quicktest (self , zfs_sr : SR ) -> None :
7671 zfs_sr .run_quicktest ()
7772
78- def test_vdi_is_not_open (self , vdi_on_zfs_sr ) :
73+ def test_vdi_is_not_open (self , vdi_on_zfs_sr : VDI ) -> None :
7974 assert not vdi_is_open (vdi_on_zfs_sr )
8075
81- def test_vdi_image_format (self , vdi_on_zfs_sr : VDI , image_format : ImageFormat ):
76+ def test_vdi_image_format (self , vdi_on_zfs_sr : VDI , image_format : ImageFormat ) -> None :
8277 fmt = vdi_on_zfs_sr .get_image_format ()
8378 # feature-detect: if the SM doesn't report image-format, skip this check
8479 if not fmt :
@@ -87,15 +82,15 @@ def test_vdi_image_format(self, vdi_on_zfs_sr: VDI, image_format: ImageFormat):
8782
8883 @pytest .mark .small_vm # run with a small VM to test the features
8984 @pytest .mark .big_vm # and ideally with a big VM to test it scales
90- def test_start_and_shutdown_VM (self , vm_on_zfs_sr ) :
85+ def test_start_and_shutdown_VM (self , vm_on_zfs_sr : VM ) -> None :
9186 vm = vm_on_zfs_sr
9287 vm .start ()
9388 vm .wait_for_os_booted ()
9489 vm .shutdown (verify = True )
9590
9691 @pytest .mark .small_vm
9792 @pytest .mark .big_vm
98- def test_snapshot (self , vm_on_zfs_sr ) :
93+ def test_snapshot (self , vm_on_zfs_sr : VM ) -> None :
9994 vm = vm_on_zfs_sr
10095 vm .start ()
10196 try :
@@ -106,23 +101,23 @@ def test_snapshot(self, vm_on_zfs_sr):
106101
107102 @pytest .mark .small_vm
108103 @pytest .mark .parametrize ("vdi_op" , ["snapshot" , "clone" ])
109- def test_coalesce (self , storage_test_vm : VM , vdi_on_zfs_sr : VDI , vdi_op : CoalesceOperation ):
104+ def test_coalesce (self , storage_test_vm : VM , vdi_on_zfs_sr : VDI , vdi_op : CoalesceOperation ) -> None :
110105 coalesce_integrity (storage_test_vm , vdi_on_zfs_sr , vdi_op )
111106
112107 @pytest .mark .small_vm
113108 @pytest .mark .parametrize ("compression" , ["none" , "gzip" , "zstd" ])
114- def test_xva_export_import (self , vm_on_zfs_sr : VM , compression : XVACompression ):
109+ def test_xva_export_import (self , vm_on_zfs_sr : VM , compression : XVACompression ) -> None :
115110 xva_export_import (vm_on_zfs_sr , compression )
116111
117112 @pytest .mark .small_vm
118- def test_vdi_export_import (self , storage_test_vm : VM , zfs_sr : SR , image_format : ImageFormat ):
113+ def test_vdi_export_import (self , storage_test_vm : VM , zfs_sr : SR , image_format : ImageFormat ) -> None :
119114 vdi_export_import (storage_test_vm , zfs_sr , image_format )
120115
121116 # *** tests with reboots (longer tests).
122117
123118 @pytest .mark .reboot
124119 @pytest .mark .small_vm
125- def test_reboot (self , vm_on_zfs_sr , host , zfs_sr ) :
120+ def test_reboot (self , vm_on_zfs_sr : VM , host : Host , zfs_sr : SR ) -> None :
126121 sr = zfs_sr
127122 vm = vm_on_zfs_sr
128123 host .reboot (verify = True )
@@ -133,7 +128,7 @@ def test_reboot(self, vm_on_zfs_sr, host, zfs_sr):
133128 vm .shutdown (verify = True )
134129
135130 @pytest .mark .reboot
136- def test_zfs_missing (self , host : Host , zfs_sr ) :
131+ def test_zfs_missing (self , host : Host , zfs_sr : SR ) -> None :
137132 sr = zfs_sr
138133 zfs_installed = True
139134 try :
@@ -161,7 +156,7 @@ def test_zfs_missing(self, host: Host, zfs_sr):
161156 host .ssh ('modprobe zfs' )
162157
163158 @pytest .mark .reboot
164- def test_zfs_unmounted (self , host : Host , zfs_sr ) :
159+ def test_zfs_unmounted (self , host : Host , zfs_sr : SR ) -> None :
165160 sr = zfs_sr
166161 zpool_imported = True
167162 try :
0 commit comments