Skip to content

Commit

Permalink
Merge pull request #278 from mulkieran/metadata-test-improvements
Browse files Browse the repository at this point in the history
Do more with RAID metadata
  • Loading branch information
mulkieran authored Aug 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 6b97c5b + 0ee826a commit a8ea927
Showing 3 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ jobs:
pylint
python3-dbus
python3-dbus-python-client-gen
python3-justbytes
python3-gobject
python3-psutil
image: fedora:40 # CURRENT DEVELOPMENT ENVIRONMENT
1 change: 1 addition & 0 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ jobs:
python3-dbus
python3-dbus-python-client-gen
python3-gobject
python3-justbytes
python3-psutil
task: PYTHONPATH=./src make -f Makefile lint
- dependencies: black python3-isort
21 changes: 14 additions & 7 deletions testlib/infra.py
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@

# isort: THIRDPARTY
import dbus
from justbytes import Range

from .dbus import StratisDbus, manager_interfaces
from .utils import exec_command, process_exists, terminate_traces
@@ -44,6 +45,7 @@
MOUNT_POINT_SUFFIX = "_stratisd_mounts"
UMOUNT = "umount"
MOUNT = "mount"
STRATIS_METADATA_LEN = Range(8192, 512)


def clean_up(): # pylint: disable=too-many-branches
@@ -270,19 +272,25 @@ def _check_crypt_meta_allocs(self, metadata):
def _check_raid_meta_allocs(self, metadata):
"""
Check that all raid_meta_allocs exist and have non-zero length.
RAID meta_allocs should start immediately after Stratis metadata ends.
"""
for raid_meta_allocs in [
a["raid_meta_allocs"]
for a in metadata["backstore"]["data_tier"]["blockdev"]["devs"]
]:
self.assertIsNotNone(raid_meta_allocs)
self.assertIsInstance(raid_meta_allocs, list)
self.assertGreater(len(raid_meta_allocs), 0)
self.assertEqual(len(raid_meta_allocs), 1)

raid_meta_allocs = raid_meta_allocs[0]
self.assertIsInstance(raid_meta_allocs, list)
self.assertGreater(raid_meta_allocs[0], 0)
self.assertGreater(raid_meta_allocs[1], 0)

raid_meta_alloc_start = Range(raid_meta_allocs[0], 512)
raid_meta_alloc_len = Range(raid_meta_allocs[1], 512)

self.assertEqual(raid_meta_alloc_start, STRATIS_METADATA_LEN)
self.assertGreater(raid_meta_alloc_len, Range(0))

def _check_integrity_meta_allocs(self, metadata):
"""
@@ -296,10 +304,9 @@ def _check_integrity_meta_allocs(self, metadata):
self.assertIsInstance(integrity_meta_allocs, list)
self.assertGreater(len(integrity_meta_allocs), 0)

integrity_meta_allocs = integrity_meta_allocs[0]
self.assertIsInstance(integrity_meta_allocs, list)
self.assertGreater(integrity_meta_allocs[0], 0)
self.assertGreater(integrity_meta_allocs[1], 0)
for alloc in integrity_meta_allocs:
self.assertGreater(alloc[0], 0)
self.assertGreater(alloc[1], 0)

def run_check(self, stop_time):
"""

0 comments on commit a8ea927

Please sign in to comment.