-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: added tests for delta.go functions #1127
base: main
Are you sure you want to change the base?
Conversation
Thanks for making a pull request! 😃 |
Codecov ReportAll 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 . |
filesystem/delta_test.go
Outdated
t.Fatalf("Failed to create destination directory: %v", err) | ||
} | ||
|
||
err = GenerateDelta(sourceDir, destinationDir, tempDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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