Skip to content

Commit ec3dbad

Browse files
misc(disk_perf): simplify fixtures
Signed-off-by: Mathieu Labourier <[email protected]>
1 parent 54a7172 commit ec3dbad

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

tests/storage/benchmarks/conftest.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,39 +55,29 @@ def vdi_on_local_sr(host, local_sr_on_hostA1, image_format):
5555
vdi.destroy()
5656

5757
@pytest.fixture(scope="module")
58-
def running_unix_vm_and_vbd(host, vdi_on_local_sr, running_unix_vm_with_fio):
58+
def plugged_vbd(vdi_on_local_sr, running_unix_vm_with_fio):
5959
vm = running_unix_vm_with_fio
6060
vdi = vdi_on_local_sr
6161
vbd = vm.create_vbd("autodetect", vdi.uuid)
6262

6363
logging.info(f">> Plugging VDI {vdi.uuid} on VM {vm.uuid}")
6464
vbd.plug()
6565

66-
yield vm, vbd
66+
yield vbd
6767

6868
# teardown
6969
logging.info(f"<< Unplugging VDI {vdi.uuid} from VM {vm.uuid}")
7070
vbd.unplug()
7171
vbd.destroy()
7272

73-
@pytest.fixture(scope="module")
74-
def vm_with_vbd(running_unix_vm_and_vbd):
75-
vm, _ = running_unix_vm_and_vbd
76-
return vm
77-
78-
@pytest.fixture(scope="module")
79-
def plugged_vbd(running_unix_vm_and_vbd):
80-
_, vbd = running_unix_vm_and_vbd
81-
return vbd
82-
8373
@pytest.fixture(scope="module")
8474
def local_temp_dir():
8575
with tempfile.TemporaryDirectory() as tmpdir:
8676
yield tmpdir
8777

8878
@pytest.fixture(scope="module")
89-
def temp_dir(vm_with_vbd):
90-
vm = vm_with_vbd
79+
def temp_dir(running_unix_vm_with_fio):
80+
vm = running_unix_vm_with_fio
9181
tempdir = vm.ssh("mktemp -d")
9282

9383
yield tempdir

tests/storage/benchmarks/test_disk_perf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ def test_disk_benchmark(
113113
block_size,
114114
file_size,
115115
rw_mode,
116-
vm_with_vbd,
116+
running_unix_vm_with_fio,
117117
plugged_vbd,
118118
image_format
119119
):
120-
vm = vm_with_vbd
120+
vm = running_unix_vm_with_fio
121121
vbd = plugged_vbd
122122
device = f"/dev/{vbd.param_get(param_name="device")}"
123123
test_type = "{}-{}-{}-{}".format(

0 commit comments

Comments
 (0)