Description
Significant code duplication exists between copy-offload migration test classes, specifically:
TestCopyoffload2TbVmSnapshotsMigration.test_create_storagemap (lines 379-454)
TestCopyoffloadThinSnapshotsMigration.test_create_storagemap (lines 196-271)
The methods are nearly identical, with only minor differences in skip messages and snapshot descriptions. This duplication increases maintenance burden and makes the codebase harder to maintain.
Proposed Solution
Extract the shared snapshot creation and storage map setup logic into a base test class (e.g., CopyoffloadBaseTest) with reusable helper methods. Both test classes should inherit from this base and call common operations while keeping only specific variations as parameters.
Affected Components
- File:
tests/test_copyoffload_migration.py
- Classes:
TestCopyoffload2TbVmSnapshotsMigration, TestCopyoffloadThinSnapshotsMigration
- Methods:
test_create_storagemap
References
Description
Significant code duplication exists between copy-offload migration test classes, specifically:
TestCopyoffload2TbVmSnapshotsMigration.test_create_storagemap(lines 379-454)TestCopyoffloadThinSnapshotsMigration.test_create_storagemap(lines 196-271)The methods are nearly identical, with only minor differences in skip messages and snapshot descriptions. This duplication increases maintenance burden and makes the codebase harder to maintain.
Proposed Solution
Extract the shared snapshot creation and storage map setup logic into a base test class (e.g.,
CopyoffloadBaseTest) with reusable helper methods. Both test classes should inherit from this base and call common operations while keeping only specific variations as parameters.Affected Components
tests/test_copyoffload_migration.pyTestCopyoffload2TbVmSnapshotsMigration,TestCopyoffloadThinSnapshotsMigrationtest_create_storagemapReferences