Skip to content

Commit

Permalink
Remove symlink-specific tests
Browse files Browse the repository at this point in the history
If we can do generic test at the end of the run, that should work
better.

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Feb 15, 2024
1 parent 0bb34b2 commit 6bb1375
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 140 deletions.
131 changes: 0 additions & 131 deletions stratisd_cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
create_relative_device_path,
exec_command,
exec_test_command,
resolve_symlink,
revision_number_type,
skip,
)
Expand Down Expand Up @@ -124,40 +123,6 @@ def make_test_filesystem(pool_path, fs_name):
return array_of_tuples_with_obj_paths_and_names[0][0]


def acquire_filesystem_symlink_targets(
pool_name, filesystem_name, pool_path, filesystem_path
):
"""
Acquire the symlink targets of the "/dev/stratis" symlink,
and the equivalent device-mapper "/dev/mapper" link, generated
via the info from get_managed_objects().
NOTE: This may require a preceding "udevadm settle" call, to
ensure that up-to-date pool and filesystem information is being
collected.
:param str pool_name: pool name
:param str filesystem_name: filesystem name
:param str pool_path: pool path
:param str filesystem_path: filesystem path
:return: str fsdevdest, str fsdevmapperlinkdest
"""
objects = StratisDbus.get_managed_objects()

pool_gmodata = objects[pool_path]
pool_uuid = pool_gmodata[StratisDbus.POOL_IFACE]["Uuid"]
filesystem_gmodata = objects[filesystem_path]
filesystem_uuid = filesystem_gmodata[StratisDbus.FS_IFACE]["Uuid"]

filesystem_devnode = "/dev/stratis/" + pool_name + "/" + filesystem_name

fs_devmapperlinkstr = (
"/dev/mapper/stratis-1-" + pool_uuid + "-thin-fs-" + filesystem_uuid
)

fsdevdest = resolve_symlink(filesystem_devnode)
fsdevmapperlinkdest = resolve_symlink(fs_devmapperlinkstr)
return fsdevdest, fsdevmapperlinkdest


class StratisCertify(unittest.TestCase):
"""
Unit tests for the stratisd package.
Expand Down Expand Up @@ -895,102 +860,6 @@ def test_filesystem_create_permissions(self):

self._test_permissions(StratisDbus.fs_create, [pool_path, fs_name], True)

@skip(_skip_condition(1))
def test_filesystem_udev_symlink_create(self):
"""
Test the udev symlink creation for filesystem devices.
"""
pool_name = p_n()
pool_path, _ = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

fs_name = fs_n()
filesystem_path = make_test_filesystem(pool_path, fs_name)

fsdevdest, fsdevmapperlinkdest = acquire_filesystem_symlink_targets(
pool_name, fs_name, pool_path, filesystem_path
)
self.assertEqual(fsdevdest, fsdevmapperlinkdest)

@skip(_skip_condition(1))
def test_filesystem_udev_symlink_fsrename(self):
"""
Test the udev symlink creation for filesystem devices after fs rename.
"""
pool_name = p_n()
pool_path, _ = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

fs_name = fs_n()
filesystem_path = make_test_filesystem(pool_path, fs_name)

fs_name_rename = fs_n()

self._unittest_command(
StratisDbus.fs_rename(pool_name, fs_name, fs_name_rename), dbus.UInt16(0)
)
# Settle after rename, to allow udev to recognize the fs rename
exec_command(["udevadm", "settle"])

fsdevdest, fsdevmapperlinkdest = acquire_filesystem_symlink_targets(
pool_name, fs_name_rename, pool_path, filesystem_path
)
self.assertEqual(fsdevdest, fsdevmapperlinkdest)

@skip(_skip_condition(1))
def test_filesystem_udev_symlink_poolrename(self):
"""
Test the udev symlink creation for filesystem devices after pool rename.
"""
pool_name = p_n()
pool_path, _ = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

fs_name = fs_n()
filesystem_path = make_test_filesystem(pool_path, fs_name)

pool_name_rename = p_n()

self._unittest_command(
StratisDbus.pool_rename(pool_name, pool_name_rename), dbus.UInt16(0)
)
# Settle after rename, to allow udev to recognize the fs rename
exec_command(["udevadm", "settle"])

fsdevdest, fsdevmapperlinkdest = acquire_filesystem_symlink_targets(
pool_name_rename, fs_name, pool_path, filesystem_path
)
self.assertEqual(fsdevdest, fsdevmapperlinkdest)

@skip(_skip_condition(1))
def test_filesystem_udev_symlink_fsrename_poolrename(self):
"""
Test the udev symlink creation for filesystem devices after fs and pool rename.
"""
pool_name = p_n()
pool_path, _ = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

fs_name = fs_n()
filesystem_path = make_test_filesystem(pool_path, fs_name)

fs_name_rename = fs_n()

self._unittest_command(
StratisDbus.fs_rename(pool_name, fs_name, fs_name_rename), dbus.UInt16(0)
)
# Settle after rename, to allow udev to recognize the filesystem rename
exec_command(["udevadm", "settle"])

pool_name_rename = p_n()

self._unittest_command(
StratisDbus.pool_rename(pool_name, pool_name_rename), dbus.UInt16(0)
)
# Settle after rename, to allow udev to recognize the pool rename
exec_command(["udevadm", "settle"])

fsdevdest, fsdevmapperlinkdest = acquire_filesystem_symlink_targets(
pool_name_rename, fs_name_rename, pool_path, filesystem_path
)
self.assertEqual(fsdevdest, fsdevmapperlinkdest)

@skip(_skip_condition(1))
def test_filesystem_rename(self):
"""
Expand Down
9 changes: 0 additions & 9 deletions testlib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ def random_string(length=4):
return "".join(random.choice(string.ascii_uppercase) for _ in range(length))


def resolve_symlink(link):
"""
Resolves the destination of a symlink
:param link: filename of the link
:return: String
"""
return os.path.abspath(os.path.join(os.path.dirname(link), os.readlink(link)))


def revision_number_type(revision_number):
"""
Raise value error if revision number is not valid.
Expand Down

0 comments on commit 6bb1375

Please sign in to comment.