Skip to content

Commit

Permalink
Add test for snapremove ALL -n ALL
Browse files Browse the repository at this point in the history
  • Loading branch information
Defenso-QTH committed Sep 4, 2024
1 parent a23b9a5 commit 17359de
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions tests/functional_tests/0020_remove_snapshot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_02_remove_snapshot_of_all_jails(

@require_root
@require_zpool
def test_03_remove_all_snapshot_fail(invoke_cli, resource_selector, skip_test):
def test_03_remove_all_snapshots_fail(invoke_cli, resource_selector, skip_test):
jails = resource_selector.all_jails_having_snapshots
skip_test(not jails)

Expand Down Expand Up @@ -123,7 +123,7 @@ def test_03_remove_all_snapshot_fail(invoke_cli, resource_selector, skip_test):

@require_root
@require_zpool
def test_04_remove_all_snapshot_success(invoke_cli, resource_selector,
def test_04_remove_all_snapshots_success(invoke_cli, resource_selector,
skip_test):
jails = resource_selector.all_jails_having_snapshots
skip_test(not jails)
Expand All @@ -146,3 +146,24 @@ def test_04_remove_all_snapshot_success(invoke_cli, resource_selector,
)

assert all(snap.exists is False for snap in remove_snaps)


@require_root
@require_zpool
def test_05_remove_all_snapshots_all_jails(invoke_cli, resource_selector,
skip_test):
jails = resource_selector.all_jails_having_snapshots
skip_test(not jails)

remove_snaps = [
snap for snap in jail.recursive_snapshots for jail in jails
]

assert len(remove_snaps) >= len(jails)
assert all(snap.exists is True for snap in remove_snaps)

invoke_cli(
['snapremove', '-n', 'ALL', 'ALL', '--force']
)

assert all(snap.exists is False for snap in remove_snaps)

0 comments on commit 17359de

Please sign in to comment.