tests: fix test_trim_device_discard_support

Instead of using workarounds, make sure to flush all the data to the disk

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2022-07-05 11:59:04 +02:00
parent a33896573e
commit 304f09e171

View File

@ -233,18 +233,10 @@ def test_trim_device_discard_support(
blktraces = start_monitoring(core_dev, cache_dev, core) blktraces = start_monitoring(core_dev, cache_dev, core)
with TestRun.step("Remove file."): with TestRun.step("Remove file."):
test_file.remove()
os_utils.sync() os_utils.sync()
os_utils.drop_caches() os_utils.drop_caches()
test_file.remove() time.sleep(5)
if filesystem == Filesystem.xfs:
with TestRun.step(
"Since issuing discard reqs is a lazy operation on XFS "
"write a small amount of data to the partition"
):
test_file = fs_utils.create_random_test_file(
os.path.join(mount_point, "test_file"), core_dev.size * 0.1
)
with TestRun.step( with TestRun.step(
"Ensure that discards were detected by blktrace on proper devices."): "Ensure that discards were detected by blktrace on proper devices."):