Skip to content
Merged
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
44 changes: 44 additions & 0 deletions tests/integration/pool/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,32 @@ def test_add_data_cache(self):
_ERROR,
)

def test_add_data_cache_mock_check(self):
"""
Test that adding 1 data device that is already in the cache tier raises
an exception.
"""
devices = _DEVICE_STRATEGY()
command_line = (
["--propagate", "pool", "init-cache"] + [self._POOLNAME] + devices
)
RUNNER(command_line)
# isort: LOCAL
import stratis_cli # pylint: disable=import-outside-toplevel

with patch.object(
# pylint: disable=protected-access
stratis_cli._actions._pool, # pyright: ignore
"_check_opposite_tier",
autospec=True,
return_value=None,
):
self.check_error(
StratisCliEngineError,
self._MENU + [self._POOLNAME] + devices,
_ERROR,
)

def test_add_data_cache_2(self):
"""
Test that adding multiple (2) data devices that are already in the cache tier raises
Expand Down Expand Up @@ -281,6 +307,24 @@ def test_add_cache_data(self):
command_line = self._MENU + [self._POOLNAME] + self._DEVICES
self.check_error(StratisCliInUseOtherTierError, command_line, _ERROR)

def test_add_cache_data_mock_check(self):
"""
Test that adding 1 cache device that is already in the data tier raises
an exception.
"""
command_line = self._MENU + [self._POOLNAME] + self._DEVICES
# isort: LOCAL
import stratis_cli # pylint: disable=import-outside-toplevel

with patch.object(
# pylint: disable=protected-access
stratis_cli._actions._pool, # pyright: ignore
"_check_opposite_tier",
autospec=True,
return_value=None,
):
self.check_error(StratisCliEngineError, command_line, _ERROR)


class AddCacheTestCase2(SimTestCase):
"""
Expand Down
Loading