Skip to content
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: increase code coverage #704

Merged

Conversation

MiahaCybersec
Copy link
Contributor

Related to #40

Copy link

codecov bot commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.46%. Comparing base (44cc2ad) to head (e4b0946).

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #704       +/-   ##
===========================================
+ Coverage   34.22%   47.46%   +13.23%     
===========================================
  Files          18       18               
  Lines        1677     1677               
===========================================
+ Hits          574      796      +222     
+ Misses       1065      826      -239     
- Partials       38       55       +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MiahaCybersec
Copy link
Contributor Author

The one failing test is due to mocks relying on github.com/tonistiigi/fsutil/types. This is required for the mocks to work. More specifically, this is required for mocking the behaviour of this line:

return ref.ReadFile(ctx, gwclient.ReadRequest{

@ashnamehrotra
Copy link
Contributor

@MiahaCybersec could you try running "go mod tidy"?

@MiahaCybersec
Copy link
Contributor Author

Had to resolve some conflicts between my branch and main which forced a merge

Miaha Cybersec added 2 commits August 9, 2024 15:00
This commit adds a new test case to verify the behavior when an invalid Docker address is provided. Ensures that the function correctly returns an error for malformed addresses.

Signed-off-by: Miaha Cybersec <[email protected]>
@MiahaCybersec
Copy link
Contributor Author

Due to the way that mocking works with the testify testing framework in Go, mocks will expect certain mock functions to exist even if they are not necessarily called. Some mocks, such as NewContainer, Inputs, and SourceMetaResolver fall into this category. Despite never being explicitly called, our tests will throw panics if these mocks do not exist.

Copy link
Contributor

@ashnamehrotra ashnamehrotra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ashnamehrotra ashnamehrotra merged commit f0cb34a into project-copacetic:main Aug 14, 2024
24 checks passed
@MiahaCybersec MiahaCybersec deleted the increase-code-coverage branch August 14, 2024 21:44
MiahaCybersec added a commit to MiahaCybersec/copacetic that referenced this pull request Aug 21, 2024
Signed-off-by: Miaha Cybersec <[email protected]>
Signed-off-by: Miaha <[email protected]>
Co-authored-by: Ashna Mehrotra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants