Skip to content

Refactor: Eliminate code duplication in MetadataStorage test cases #156

@coderabbitai

Description

@coderabbitai

Description

The test file tests/storage/test-MetadataStorage.cpp contains duplicated task graph setup code across multiple test cases, specifically in the "Job cancel" and "Job cancel by task" tests around lines 465-489 and 531-555.

Both test cases contain nearly identical code (approximately 25 lines each) for creating the same task graph structure with child_task, parent_1, and parent_2 tasks. This duplication violates the DRY principle and makes maintenance more difficult.

Proposed Solution

Extract the common setup code into a helper function that initializes and returns the task graph and associated tasks. This will improve code maintainability and test readability.

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