Skip to content

Commit

Permalink
Merge pull request #224 from bgurney-rh/fslimit-dbus
Browse files Browse the repository at this point in the history
testlib/dbus: have fs_create() handle fs_sizelimit
  • Loading branch information
mulkieran authored Oct 21, 2023
2 parents 5d53fdf + 4f1ee66 commit 34acd3c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
34 changes: 34 additions & 0 deletions stratisd_cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
8 changes: 6 additions & 2 deletions testlib/dbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand All @@ -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)
Expand Down

0 comments on commit 34acd3c

Please sign in to comment.