feat(2304): update checksum and timestamp file paths to include task … #2305
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses #2304 where checksum and timestamp files were not being created in the correct directory when tasks were executed in a subdirectory. The changes ensure that these files are stored within a directory structure that mirrors the task's execution directory, relative to the temporary directory. Additionally a test has been added to verify the correct behaviour.
Motivation
Previously, the checksum and timestamp files were always created in a flat
checksum
ortimestamp
directory within the temporary directory, regardless of the task's execution directory. This could lead to conflicts and incorrect up-to-date checks when multiple tasks with the same name were executed in different subdirectories.The motivation behind this change is to ensure that the fingerprinting mechanism correctly tracks task dependencies and execution state, even when tasks are executed in different directories. This is crucial for maintaining the reliability and correctness of the task execution process.
What was changed
internal/fingerprint/sources_checksum.go
: TheIsUpToDate
function was modified to create the checksum directory within a subdirectory that mirrors the task's execution directory (t.Dir
). ThechecksumFilePath
function was also updated accordingly.internal/fingerprint/sources_timestamp.go
: ThetimestampFilePath
function was updated to create the timestamp directory within a subdirectory that mirrors the task's execution directory (t.Dir
).internal/fingerprint/sources_timestamp_test.go
: A new test filesources_timestamp_test.go
was added to verify the correct creation of timestamp files in the appropriate subdirectories.internal/fingerprint/timestamp_checker_test.go
: A new test filetimestamp_checker_test.go
was added to improve testing the functionality of timestamp checker.task_test.go
: The checksum path generation in theTestStatusChecksum
was adapted to the changed directory structure.Tests
internal/fingerprint/sources_timestamp_test.go
to specifically verify the correct creation of timestamp files in the appropriate subdirectories.internal/fingerprint/timestamp_checker_test.go
to improve testing the functionality of timestamp checker.task_test.go