Skip to content

Refactor duplicated test logic in copy-offload migration tests into base class #277

Description

@coderabbitai

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions