Skip to content
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
43 changes: 43 additions & 0 deletions stratisd_cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,49 @@ def test_get_keys_permissions(self):
"""
self._test_permissions(StratisDbus.get_keys, [], False)

@skip(_skip_condition(1))
def test_pool_start_without_cache(self):
"""
Test starting a stopped pool by its name without cache.
"""
pool_name = p_n()
make_test_pool(pool_name, StratisCertify.DISKS[0:1])

self._unittest_command(
StratisDbus.pool_stop(pool_name, "name"),
dbus.UInt16(0),
)

self._unittest_command(
StratisDbus.pool_start(pool_name, "name", remove_cache=True),
dbus.UInt16(0),
)

@skip(_skip_condition(1))
def test_pool_start_without_cache_encrypted(self):
"""
Test starting an encrypted stopped pool by its name without cache.
"""
pool_name = p_n()

with KernelKey("test-password") as key_desc:
make_test_pool(pool_name, StratisCertify.DISKS[0:1], key_desc=key_desc)

self._unittest_command(
StratisDbus.pool_stop(pool_name, "name"),
dbus.UInt16(0),
)

self._unittest_command(
StratisDbus.pool_start(
pool_name,
"name",
unlock_method=(True, (False, 0)),
remove_cache=True,
),
dbus.UInt16(0),
)


class StratisdManPageCertify(StratisCertify):
"""
Expand Down
6 changes: 4 additions & 2 deletions testlib/dbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,21 @@ def get_keys():
return iface.ListKeys(timeout=StratisDbus._TIMEOUT)

@staticmethod
def pool_start(id_string, id_type):
def pool_start(id_string, id_type, *, unlock_method=None, remove_cache=False):
"""
Start a pool
:param str id: The identifier of the pool to start
:param str type: The type of identifier ("uuid" or "name")
"""

unlock_method = (False, (False, 0)) if unlock_method is None else unlock_method
manager_iface = dbus.Interface(
StratisDbus._BUS.get_object(StratisDbus._BUS_NAME, StratisDbus._TOP_OBJECT),
StratisDbus._MNGR_IFACE,
)

return manager_iface.StartPool(
id_string, id_type, (False, (False, 0)), (False, 0), False
id_string, id_type, unlock_method, (False, 0), remove_cache
)

@staticmethod
Expand Down
11 changes: 10 additions & 1 deletion testlib/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,16 @@ def __init__(self, *, test_id=None):
"""
self.dbus_monitor = DbusMonitor()
# See: https://github.com/stratis-storage/project/issues/741
if test_id is None or not test_id.endswith("test_pool_add_data_init_cache"):
if test_id is None or all(
not test_id.endswith(test_name)
for test_name in [
"test_pool_add_data_init_cache",
"test_pool_start_by_name",
"test_pool_start_stopped",
"test_pool_start_without_cache",
"test_pool_start_without_cache_encrypted",
]
):
self.dbus_monitor.setUp()

def teardown(self):
Expand Down