Skip to content

Commit

Permalink
WIP ZFS-ng: test chain of VDI clones and their destuction
Browse files Browse the repository at this point in the history
FIXME:
* cloning a VDI without a snapshot is not implemented yet
  • Loading branch information
ydirson committed Mar 11, 2024
1 parent 5ff3cdc commit 25ea394
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/storage/zfs_ng/test_zfs_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,29 @@ def test_vdi_and_snaps_destroy_intermediate_vdi(self, vdi_and_snaps_chain):
vdi.destroy()
# tell fixture we destroyed that one
vdi_and_snaps_chain[2:3] = []

@pytest.fixture(scope='package')
def vdi_chain(zfs_sr):
""" A chain of VDI clones on first host. """
vdis = [zfs_sr.create_vdi('ZFS-local-VDI-test')]
for i in range(2):
vdis.append(vdis[-1].clone())
yield vdis
# teardown
for vdi in reversed(vdis):
vdi.destroy()

@pytest.mark.xfail
@pytest.mark.usefixtures("vdi_chain")
class TestZfsngSrVdiDestroy:
def test_destroy(self, vdi_chain):
assert len(vdi_chain) == 3

def test_destroy_last(self, vdi_chain):
vdi_chain[-1].destroy()

def test_destroy_first(self, vdi_chain):
vdi_chain[0].destroy()

def test_destroy_intermediate(self, vdi_chain):
vdi_chain[1].destroy()

0 comments on commit 25ea394

Please sign in to comment.