-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NAS-130914 / 25.04 / remove REST from test_360 (and rename) (#14443)
- Loading branch information
Showing
2 changed files
with
86 additions
and
77 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import errno | ||
|
||
import pytest | ||
|
||
from auto_config import pool_name | ||
from middlewared.service_exception import ValidationError, ValidationErrors | ||
from middlewared.test.integration.utils import call | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def scrub_info(): | ||
for i in call("pool.scrub.query", [["pool_name", "=", pool_name]]): | ||
return i | ||
else: | ||
# by default, on pool creation a scrub task is created | ||
assert False, f"Failed to find scrub job for {pool_name!r}" | ||
|
||
|
||
def test_create_duplicate_scrub_fails(scrub_info): | ||
with pytest.raises(ValidationErrors) as ve: | ||
call( | ||
"pool.scrub.create", | ||
{ | ||
"pool": scrub_info["pool"], | ||
"threshold": 1, | ||
"description": "", | ||
"schedule": { | ||
"minute": "00", | ||
"hour": "00", | ||
"dom": "1", | ||
"month": "1", | ||
"dow": "1", | ||
}, | ||
"enabled": True, | ||
}, | ||
) | ||
assert ve.value.errors == [ | ||
ValidationError( | ||
"pool_scrub_create.pool", | ||
"A scrub with this pool already exists", | ||
errno.EINVAL, | ||
) | ||
] | ||
|
||
|
||
def test_update_scrub(scrub_info): | ||
assert call( | ||
"pool.scrub.update", | ||
scrub_info["id"], | ||
{ | ||
"threshold": 2, | ||
"description": "", | ||
"schedule": { | ||
"minute": "00", | ||
"hour": "00", | ||
"dom": "1", | ||
"month": "1", | ||
"dow": "1", | ||
}, | ||
"enabled": True, | ||
}, | ||
) | ||
|
||
|
||
def test_delete_scrub(scrub_info): | ||
call("pool.scrub.delete", scrub_info["id"]) | ||
assert call("pool.scrub.query", [["pool_name", "=", pool_name]]) == [] | ||
|
||
|
||
def test_create_scrub(scrub_info): | ||
assert call( | ||
"pool.scrub.create", | ||
{ | ||
"pool": scrub_info["pool"], | ||
"threshold": 1, | ||
"description": "", | ||
"schedule": { | ||
"minute": "00", | ||
"hour": "00", | ||
"dom": "1", | ||
"month": "1", | ||
"dow": "1", | ||
}, | ||
"enabled": True, | ||
}, | ||
) |