diff --git a/stratis_cli_cert.py b/stratis_cli_cert.py index aa0b81f..8f56c8c 100644 --- a/stratis_cli_cert.py +++ b/stratis_cli_cert.py @@ -1209,6 +1209,27 @@ def test_filesystem_mount_and_write(self): ] ) + @skip(_skip_condition(1)) + def test_filesystem_debug_get_metadata(self): + """ + Test running "stratis filesystem debug get-metadata" on a pool. + """ + pool_name = make_test_pool(StratisCliCertify.DISKS[0:1]) + filesystem_name = make_test_filesystem(pool_name) + self._unittest_command( + [ + _STRATIS_CLI, + "filesystem", + "debug", + "get-metadata", + pool_name, + f"--fs-name={filesystem_name}", + ], + 0, + True, + False, + ) + @skip(_skip_condition(1)) def test_pool_stop_stopped(self): """ diff --git a/stratisd_cert.py b/stratisd_cert.py index 47aeaf7..3c751d5 100644 --- a/stratisd_cert.py +++ b/stratisd_cert.py @@ -1057,6 +1057,21 @@ def test_filesystem_mount_and_write(self): ] ) + @skip(_skip_condition(1)) + def test_filesystem_get_metadata(self): + """ + Test getting filesystem metadata info. + """ + pool_name = p_n() + pool_path, _ = make_test_pool(pool_name, StratisCertify.DISKS[0:1]) + + fs_name = fs_n() + make_test_filesystem(pool_path, fs_name) + + self._unittest_command( + StratisDbus.fs_get_metadata(pool_path, fs_name=fs_name), dbus.UInt16(0) + ) + def test_get_report(self): """ Test getting a valid and invalid report. diff --git a/testlib/dbus.py b/testlib/dbus.py index 3a96adc..bba2561 100644 --- a/testlib/dbus.py +++ b/testlib/dbus.py @@ -499,6 +499,30 @@ def pool_get_metadata(pool_path, *, current=True): ) return iface.Metadata(current, timeout=StratisDbus._TIMEOUT) + @staticmethod + def fs_get_metadata(pool_path, *, fs_name=None, current=True): + """ + Get filesystem-level metadata + :param str pool_path: The object path of the pool + :param str fs_name: The name of the filesystem + :param bool current: Current or most recently written metadata + :return: JSON-format pool-level metadata + :rtype: The D-Bus types s, q, and s + :raises dbus.exceptions.DBusException: + """ + iface = dbus.Interface( + StratisDbus._BUS.get_object(StratisDbus._BUS_NAME, pool_path), + StratisDbus._POOL_IFACE, + ) + + fs_name = (False, "") if fs_name is None else (True, fs_name) + + return iface.FilesystemMetadata( + (False, "") if fs_name is None else (True, fs_name), + current, + timeout=StratisDbus._TIMEOUT, + ) + @staticmethod def fs_create(pool_path, fs_name, *, fs_size=None, fs_sizelimit=None): """