Skip to content

Commit

Permalink
blocksd_test: check actual size for extend test
Browse files Browse the repository at this point in the history
Current extend_volume_skipped test checks
only that the volume remains under the original
capacity. While this covers the usecase of
the volume not being extended to the new
capacity, it does not check that the volume
size has not changed.

We can make the check more precise with
little effort.

Fixes: a558d52
Signed-off-by: Albert Esteve <aesteve@redhat.com>
  • Loading branch information
aesteve-rh committed Feb 27, 2023
1 parent bc74ff5 commit 543d7f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/storage/blocksd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1925,14 +1925,17 @@ def test_extend_volume_skipped(domain_factory, fake_task, fake_sanlock):
srcImgUUID=sc.BLANK_UUID,
srcVolUUID=sc.BLANK_UUID)

# Obtain the volume size before the extend call.
initial_vol_size = dom.getVolumeSize(img_uuid, vol_id)

# Produce and extend volume to the new capacity, but we skip extends for
# cow sparse volumes.
vol = dom.produceVolume(img_uuid, vol_id)
vol.extendSize(new_capacity)

# Check that volume size has not changed.
assert dom.getVolumeSize(img_uuid, vol_id).truesize <= vol_capacity
assert dom.getVolumeSize(img_uuid, vol_id).apparentsize <= vol_capacity
vol_size = dom.getVolumeSize(img_uuid, vol_id)
assert vol_size == initial_vol_size


LVM_TAG_CHARS = string.ascii_letters + "0123456789_+.-/=!:#"
Expand Down

0 comments on commit 543d7f4

Please sign in to comment.