Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-130914 / 25.04 / remove REST from test_360 (and rename) #14443

Merged
merged 3 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
},
)
Loading