tests: fix test_negative_start_cache
Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
parent
b8d6f8403e
commit
8d4262079e
@ -6,16 +6,16 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||||
from api.cas.casadm_params import OutputFormat
|
from api.cas.casadm_params import OutputFormat
|
||||||
from api.cas.cli import start_cmd
|
from api.cas.cli import start_cmd
|
||||||
from core.test_run import TestRun
|
|
||||||
from api.cas import casadm
|
|
||||||
from api.cas.cli_messages import (
|
from api.cas.cli_messages import (
|
||||||
check_stderr_msg,
|
check_stderr_msg,
|
||||||
start_cache_on_already_used_dev,
|
start_cache_on_already_used_dev,
|
||||||
start_cache_with_existing_id,
|
start_cache_with_existing_id,
|
||||||
)
|
)
|
||||||
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_utils
|
from test_tools import fs_utils
|
||||||
from test_tools.dd import Dd
|
from test_tools.dd import Dd
|
||||||
@ -81,31 +81,31 @@ def test_negative_start_cache():
|
|||||||
|
|
||||||
with TestRun.step("Start cache on the same device but with another ID"):
|
with TestRun.step("Start cache on the same device but with another ID"):
|
||||||
try:
|
try:
|
||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run_expect_fail(
|
||||||
start_cmd(
|
start_cmd(
|
||||||
cache_dev=cache_dev_1.path,
|
cache_dev=cache_dev_1.path,
|
||||||
cache_id="2",
|
cache_id="2",
|
||||||
force=True,
|
force=True,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
TestRun.fail("Two caches started on same device")
|
|
||||||
except CmdException:
|
|
||||||
if not check_stderr_msg(output, start_cache_on_already_used_dev):
|
if not check_stderr_msg(output, start_cache_on_already_used_dev):
|
||||||
TestRun.fail(f"Received unexpected error message: {output.stderr}")
|
TestRun.fail(f"Received unexpected error message: {output.stderr}")
|
||||||
|
except CmdException:
|
||||||
|
TestRun.fail("Two caches started on same device")
|
||||||
|
|
||||||
with TestRun.step("Start cache with the same ID on another cache device"):
|
with TestRun.step("Start cache with the same ID on another cache device"):
|
||||||
try:
|
try:
|
||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run_expect_fail(
|
||||||
start_cmd(
|
start_cmd(
|
||||||
cache_dev=cache_dev_2.path,
|
cache_dev=cache_dev_2.path,
|
||||||
cache_id="1",
|
cache_id="1",
|
||||||
force=True,
|
force=True,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
TestRun.fail("Two caches started with same ID")
|
|
||||||
except CmdException:
|
|
||||||
if not check_stderr_msg(output, start_cache_with_existing_id):
|
if not check_stderr_msg(output, start_cache_with_existing_id):
|
||||||
TestRun.fail(f"Received unexpected error message: {output.stderr}")
|
TestRun.fail(f"Received unexpected error message: {output.stderr}")
|
||||||
|
except CmdException:
|
||||||
|
TestRun.fail("Two caches started with same ID")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.CI
|
@pytest.mark.CI
|
||||||
|
Loading…
Reference in New Issue
Block a user