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
Description
The test file
tests/storage/test-MetadataStorage.cppcontains 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