test: added tests for delta.go functions#1127
Conversation
|
Thanks for making a pull request! 😃 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1127 +/- ##
==========================================
+ Coverage 14.89% 15.47% +0.58%
==========================================
Files 90 90
Lines 8380 8380
==========================================
+ Hits 1248 1297 +49
+ Misses 6809 6744 -65
- Partials 323 339 +16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kmehant
left a comment
There was a problem hiding this comment.
Thanks @satyazzz123, Appreciate your contributions.
Would you like to cover other functions in the delta.go file in this PR?
I will review and merge other PRs ASAP. Thank you.
Yes I will cover other functions in this PR as well and add some more cases too for delta.go . |
| t.Fatalf("Failed to create destination directory: %v", err) | ||
| } | ||
|
|
||
| err = GenerateDelta(sourceDir, destinationDir, tempDir) |
There was a problem hiding this comment.
Check the contents of the destinationDir after the function executes.
| } | ||
|
|
||
| // Check for modifications file | ||
| modificationsFilePath := filepath.Join(tempDir, "modifications", "file.txt") |
There was a problem hiding this comment.
Also add a check for the contents of the destinationDir after the function executes.
|
|
||
| // Check for modifications file | ||
| modificationsFilePath := filepath.Join(tempDir, "modifications", "file.txt") | ||
| if _, err := os.Stat(modificationsFilePath); os.IsNotExist(err) { |
There was a problem hiding this comment.
Also check the contents of the file.
| t.Errorf("Unexpected error during generateDeltaAdditionCallBack: %v", err) | ||
| } | ||
|
|
||
| replicatedFilePath := filepath.Join(tempDir, additionsDir, "newfile.txt") |
There was a problem hiding this comment.
Also add a check for the contents of the destinationDir after the function executes.
| } | ||
|
|
||
| replicatedFilePath := filepath.Join(tempDir, additionsDir, "newfile.txt") | ||
| if _, err := os.Stat(replicatedFilePath); os.IsNotExist(err) { |
There was a problem hiding this comment.
Also check the contents of the file.
|
@HarikrishnanBalagopal I have addressed the requested changes . Please have a look. Thank you |
Signed-off-by: satyazzz123 <beherasatyajit716@gmail.com>
Signed-off-by: satyazzz123 <beherasatyajit716@gmail.com>
Signed-off-by: satyazzz123 <beherasatyajit716@gmail.com>
Signed-off-by: satyazzz123 <beherasatyajit716@gmail.com>
47ef9f5 to
c48391b
Compare
test for delta.go functions
i) this test scenario covers the creation of source and destination directory and successful execution of GenerateDelta function.
ii)this test covers the scenario for the presence of a modifications file and its content after calling the GenerateDelta function.
iii) this test covers the scenario where generateDeltaAdditionCallBack correctly replicates a source file to the additions directory based on the provided configuration and if the replicated file is created in the expected location.
partly fixes #881