From 341adbc6a95a6321dbafb0f00398e30d2e1ee6c8 Mon Sep 17 00:00:00 2001 From: mulhern Date: Fri, 20 Dec 2024 17:33:27 -0500 Subject: [PATCH] Add a test of an invalid integrity journal size Signed-off-by: mulhern --- src/stratis_cli/_actions/_pool.py | 2 +- .../whitebox/integration/pool/test_create.py | 20 +++++++++++++++++++ tests/whitebox/integration/test_parser.py | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/stratis_cli/_actions/_pool.py b/src/stratis_cli/_actions/_pool.py index f1a6d6ef2..89dec7f81 100644 --- a/src/stratis_cli/_actions/_pool.py +++ b/src/stratis_cli/_actions/_pool.py @@ -215,7 +215,7 @@ def create_pool(namespace): # pylint: disable=too-many-locals }, ) - if return_code != StratisdErrors.OK: # pragma: no cover + if return_code != StratisdErrors.OK: raise StratisCliEngineError(return_code, message) if not changed: # pragma: no cover diff --git a/tests/whitebox/integration/pool/test_create.py b/tests/whitebox/integration/pool/test_create.py index 36e5b3002..6201f2012 100644 --- a/tests/whitebox/integration/pool/test_create.py +++ b/tests/whitebox/integration/pool/test_create.py @@ -18,6 +18,7 @@ # isort: LOCAL from stratis_cli import StratisCliErrorCodes from stratis_cli._errors import ( + StratisCliEngineError, StratisCliInUseSameTierError, StratisCliNameConflictError, ) @@ -165,3 +166,22 @@ def test_no_overprovision(self): self._MENU + [self._POOLNAME] + self._DEVICES + ["--no-overprovision"] ) TEST_RUNNER(command_line) + + +class Create7TestCase(SimTestCase): + """ + Test create with integrity options. + """ + + _MENU = ["--propagate", "pool", "create"] + _DEVICES = _DEVICE_STRATEGY() + _POOLNAME = "thispool" + + def test_invalid_journal_size(self): + """ + Test creating with an invalid journal size. + """ + command_line = ( + self._MENU + [self._POOLNAME] + self._DEVICES + ["--journal-size=131079MiB"] + ) + self.check_error(StratisCliEngineError, command_line, _ERROR) diff --git a/tests/whitebox/integration/test_parser.py b/tests/whitebox/integration/test_parser.py index a27e2145b..54682733f 100644 --- a/tests/whitebox/integration/test_parser.py +++ b/tests/whitebox/integration/test_parser.py @@ -23,7 +23,7 @@ _PARSE_ERROR = StratisCliErrorCodes.PARSE_ERROR -class ParserTestCase(RunTestCase): +class ParserTestCase(RunTestCase): # pylint: disable=too-many-public-methods """ Test parser behavior. The behavior should be identical, regardless of whether the "--propagate" flag is set. That is, stratis should never produce