Skip to content

Commit

Permalink
NAS-130914 / 25.04 / remove REST from test_360 (and rename) (#14443)
Browse files Browse the repository at this point in the history
  • Loading branch information
yocalebo authored Sep 6, 2024
1 parent a7c5455 commit e832232
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 77 deletions.
77 changes: 0 additions & 77 deletions tests/api2/test_360_pool_scrub.py

This file was deleted.

86 changes: 86 additions & 0 deletions tests/api2/test_pool_scrub.py
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,
},
)

0 comments on commit e832232

Please sign in to comment.