Skip to content

test: added test for Processor.go functions - #1124

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

test: added test for Processor.go functions#1124
satyazzz123 wants to merge 7 commits into
konveyor:mainfrom
satyazzz123:satyazzz123/5

Conversation

@satyazzz123

@satyazzz123 satyazzz123 commented Dec 15, 2023

Copy link
Copy Markdown
Contributor

test for filesystem processor.go functions

i) this test case covers a scenario where it checks if newProcessor function creates a processor instance with the given options.
ii) test for the scenario where the processFile function is able to succesfully process the file.
iii)test for scenario when processDirectory successfully processes an existing source and existing destination directory.
iv) test for sceanrio when process function succesfully processes an existing source and existing destination directory.

partly fixes #881

@github-actions

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 Dec 15, 2023
@codecov

codecov Bot commented Dec 15, 2023

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1124      +/-   ##
==========================================
+ Coverage   14.89%   15.15%   +0.26%     
==========================================
  Files          90       90              
  Lines        8380     8380              
==========================================
+ Hits         1248     1270      +22     
+ Misses       6809     6777      -32     
- Partials      323      333      +10     

☔ View full report in Codecov by Harness.
📢 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 Please Review this PR.

@kmehant

kmehant commented Dec 18, 2023

Copy link
Copy Markdown
Member

Thank you for the contribution @satyazzz123

Can you add more test cases to this PR to cover other functions in this file (processor.go)?

cc @seshapad

@satyazzz123

Copy link
Copy Markdown
Contributor Author

Thank you for the contribution @satyazzz123

Can you add more test cases to this PR to cover other functions in this file (processor.go)?

cc @seshapad

Yes , I am working on other test cases as well will soon raise a PR soon covering more functions and cases

@kmehant

kmehant commented Dec 18, 2023

Copy link
Copy Markdown
Member

#1124 (comment)

Lets expand the scope of this PR (instead of creating new ones) to test complete processor.go.

@satyazzz123

Copy link
Copy Markdown
Contributor Author

#1124 (comment)

Lets expand the scope of this PR (instead of creating new ones) to test complete processor.go.

Got it will push commits to this PR itself adding more tests

@satyazzz123

Copy link
Copy Markdown
Contributor Author

@kmehant I have added some more test cases . Please have a look

@HarikrishnanBalagopal HarikrishnanBalagopal left a comment

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.

Please flesh out the tests to be more meaningful. Most of the fields and callbacks are empty/nil and the tests don't actually test anything.

processor := newProcessor(mockOptions)

// Check that the returned processor is not nil
if processor == nil {

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 if the config and callbacks are preserved.

err := processor.processFile(source, destination)

// Assert the result
if err != nil {

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.

Fix formatting


t.Run("test for the scenario where the processing of a file is successful", func(t *testing.T) {
source := "path/to/source/file.txt"
destination := "path/to/destination/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.

Fix formatting

err := processor.processFile(source, destination)

// Assert the result
if err != nil {

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 if the file was processed correctly.

@HarikrishnanBalagopal

Copy link
Copy Markdown
Contributor

related #1071

@satyazzz123 satyazzz123 changed the title test: added test for newProcessor function test: added test for Processor.go function Jan 9, 2024
@satyazzz123 satyazzz123 changed the title test: added test for Processor.go function test: added test for Processor.go functions Jan 9, 2024
@kmehant

kmehant commented Jan 16, 2024

Copy link
Copy Markdown
Member

@satyazzz123 any update on this PR referring to @HarikrishnanBalagopal's review?

@satyazzz123

Copy link
Copy Markdown
Contributor Author

@satyazzz123 any update on this PR referring to @HarikrishnanBalagopal's review?

Yes I am working on the changes right now will soon push the changes also adding some more test cases to increase test coverage for processor.go functions

@satyazzz123

Copy link
Copy Markdown
Contributor Author

There were some new tests I had added to processor.go but they were failing before I am fixing them and raising a PR. Sorry for the delay 😥

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>
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