Merge pull request #862 from mmichal10/test-force-correct-serial

tests: force correct disk serial
This commit is contained in:
Robert Baldyga 2021-07-02 09:39:47 +02:00 committed by GitHub
commit 746538129b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -6,7 +6,7 @@
# Order in arrays is important!
config_stats_cache = [
"cache id", "cache size", "cache device", "core devices", "inactive core devices",
"write policy", "eviction policy", "cleaning policy", "promotion policy", "cache line size",
"write policy", "cleaning policy", "promotion policy", "cache line size",
"metadata memory footprint", "dirty for", "metadata mode", "status"
]
config_stats_core = [
@ -230,7 +230,6 @@ class CacheConfigStats:
core_dev,
inactive_core_dev,
write_policy,
eviction_policy,
cleaning_policy,
promotion_policy,
cache_line_size,
@ -245,7 +244,6 @@ class CacheConfigStats:
self.core_dev = core_dev
self.inactive_core_dev = inactive_core_dev
self.write_policy = write_policy
self.eviction_policy = eviction_policy
self.cleaning_policy = cleaning_policy
self.promotion_policy = promotion_policy
self.cache_line_size = cache_line_size
@ -263,7 +261,6 @@ class CacheConfigStats:
f"Core devices: {self.core_dev}\n"
f"Inactive core devices: {self.inactive_core_dev}\n"
f"Write policy: {self.write_policy}\n"
f"Eviction policy: {self.eviction_policy}\n"
f"Cleaning policy: {self.cleaning_policy}\n"
f"Promotion policy: {self.promotion_policy}\n"
f"Cache line size: {self.cache_line_size}\n"
@ -283,7 +280,6 @@ class CacheConfigStats:
and self.core_dev == other.core_dev
and self.inactive_core_dev == other.inactive_core_dev
and self.write_policy == other.write_policy
and self.eviction_policy == other.eviction_policy
and self.cleaning_policy == other.cleaning_policy
and self.promotion_policy == other.promotion_policy
and self.cache_line_size == other.cache_line_size

View File

@ -20,6 +20,7 @@ from api.cas import casadm
from api.cas import git
from storage_devices.raid import Raid
from test_utils.os_utils import Udev, kill_all_io
from test_utils.disk_finder import get_disk_serial_number
from test_tools.disk_utils import PartitionTable, create_partition_table
from test_tools.device_mapper import DeviceMapper
from test_tools.mdadm import Mdadm
@ -199,6 +200,13 @@ def base_prepare(item):
Udev.settle()
for disk in TestRun.dut.disks:
disk_serial = get_disk_serial_number(disk.path)
if disk.serial_number != disk_serial:
raise Exception(
f"Serial for {disk.path} doesn't match the one from the config."
f"Serial from config {disk.serial_number}, actual serial {disk_serial}"
)
disk.umount_all_partitions()
Mdadm.zero_superblock(os.path.join('/dev', disk.get_device_id()))
TestRun.executor.run_expect_success("udevadm settle")