diff --git a/stratisd_cert.py b/stratisd_cert.py index bffd9d9..3caf6bb 100644 --- a/stratisd_cert.py +++ b/stratisd_cert.py @@ -815,6 +815,40 @@ def test_filesystem_create_specified_size_toosmall(self): dbus.UInt16(1), ) + @skip(_skip_condition(1)) + def test_filesystem_create_specified_size_limit(self): + """ + Test creating a filesystem with a specified size limit. + """ + pool_name = p_n() + pool_path, _ = make_test_pool(pool_name, StratisCertify.DISKS[0:1]) + + fs_name = fs_n() + + self._unittest_command( + StratisDbus.fs_create( + pool_path, fs_name, fs_size="549755813888", fs_sizelimit="1099511627776" + ), + dbus.UInt16(0), + ) + + @skip(_skip_condition(1)) + def test_filesystem_create_specified_size_limit_toosmall(self): + """ + Test creating a filesystem with a specified size limit that is too small. + """ + pool_name = p_n() + pool_path, _ = make_test_pool(pool_name, StratisCertify.DISKS[0:1]) + + fs_name = fs_n() + + self._unittest_command( + StratisDbus.fs_create( + pool_path, fs_name, fs_size="549755813888", fs_sizelimit="536866816" + ), + dbus.UInt16(1), + ) + @skip(_skip_condition(1)) def test_filesystem_create_permissions(self): """ diff --git a/testlib/dbus.py b/testlib/dbus.py index cb80c81..1104f4e 100644 --- a/testlib/dbus.py +++ b/testlib/dbus.py @@ -470,12 +470,14 @@ def pool_set_property(pool_path, param_iface, dbus_param, dbus_value): ) @staticmethod - def fs_create(pool_path, fs_name, *, fs_size=None): + def fs_create(pool_path, fs_name, *, fs_size=None, fs_sizelimit=None): """ Create a filesystem :param str pool_path: The object path of the pool in which the filesystem will be created :param str fs_name: The name of the filesystem to create :param str fs_size: The size of the filesystem to create + :param str fs_size: The size of the filesystem to create + :param str fs_sizelimit: The size limit of the filesystem to create :return: The return values of the CreateFilesystems call :rtype: The D-Bus types (ba(os)), q, and s """ @@ -485,7 +487,9 @@ def fs_create(pool_path, fs_name, *, fs_size=None): ) file_spec = ( - (fs_name, (False, "")) if fs_size is None else (fs_name, (True, fs_size)) + fs_name, + (False, "") if fs_size is None else (True, fs_size), + (False, "") if fs_sizelimit is None else (True, fs_sizelimit), ) return iface.CreateFilesystems([file_spec], timeout=StratisDbus._TIMEOUT)