Skip to content

test: added tests for delta.go functions#1127

Open
satyazzz123 wants to merge 4 commits into
konveyor:mainfrom
satyazzz123:satyazzz123/7
Open

test: added tests for delta.go functions#1127
satyazzz123 wants to merge 4 commits into
konveyor:mainfrom
satyazzz123:satyazzz123/7

Conversation

@satyazzz123

@satyazzz123 satyazzz123 commented Jan 3, 2024

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jan 3, 2024

Copy link
Copy Markdown

Thanks for making a pull request! 😃
One of the maintainers will review and advise on the next steps.

@github-actions github-actions Bot added the test label Jan 3, 2024
@codecov

codecov Bot commented Jan 3, 2024

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 15.47%. Comparing base (d9f7e62) to head (c48391b).
⚠️ Report is 19 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@satyazzz123

Copy link
Copy Markdown
Contributor Author

@seshapad @kmehant I have raised a PR. Please have a look

@kmehant kmehant left a comment

Copy link
Copy Markdown
Member

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.

@satyazzz123

Copy link
Copy Markdown
Contributor Author

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 .

Comment thread filesystem/delta_test.go Outdated
t.Fatalf("Failed to create destination directory: %v", err)
}

err = GenerateDelta(sourceDir, destinationDir, tempDir)

Copy link
Copy Markdown
Contributor

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.

Comment thread filesystem/delta_test.go
}

// Check for modifications file
modificationsFilePath := filepath.Join(tempDir, "modifications", "file.txt")

Copy link
Copy Markdown
Contributor

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.

Comment thread filesystem/delta_test.go

// Check for modifications file
modificationsFilePath := filepath.Join(tempDir, "modifications", "file.txt")
if _, err := os.Stat(modificationsFilePath); os.IsNotExist(err) {

Copy link
Copy Markdown
Contributor

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.

Comment thread filesystem/delta_test.go
t.Errorf("Unexpected error during generateDeltaAdditionCallBack: %v", err)
}

replicatedFilePath := filepath.Join(tempDir, additionsDir, "newfile.txt")

Copy link
Copy Markdown
Contributor

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.

Comment thread filesystem/delta_test.go
}

replicatedFilePath := filepath.Join(tempDir, additionsDir, "newfile.txt")
if _, err := os.Stat(replicatedFilePath); os.IsNotExist(err) {

Copy link
Copy Markdown
Contributor

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.

@satyazzz123

Copy link
Copy Markdown
Contributor Author

@HarikrishnanBalagopal I have addressed the requested changes . Please have a look. Thank you

@satyazzz123 satyazzz123 requested a review from kmehant January 9, 2024 13:30
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Test the filesystem package.

3 participants