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

Added tests for AdminDBScan method #6474

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jakobht
Copy link
Contributor

@jakobht jakobht commented Nov 4, 2024

What changed?
Added tests for AdminDBScan method.

This unveiled 3 issues with the code

  • We called defer on results before checking the error leading to nil ptr crashes
  • If the input file had invalid data the method would go into an infinite loop
  • If the input file was empty the command would just succeed with no output

Aditionally this

  • Fixes the error wrapping in the function
  • Adds a StringSliceArgument to the clitest package
  • Adds testdata files for the AdminDBScan method as it reads a file

Why?
Improve test coverage and fix the bugs

How did you test it?

Potential risks

Release notes

Documentation Changes

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 68.42105% with 6 lines in your changes missing coverage. Please review.

Project coverage is 79.85%. Comparing base (d73f42c) to head (fb517b8).
Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
tools/cli/clitest/context.go 0.00% 6 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
tools/cli/admin_db_scan_command.go 54.11% <100.00%> (+54.11%) ⬆️
tools/cli/clitest/context.go 81.25% <0.00%> (-18.75%) ⬇️

... and 27 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5274f8...fb517b8. Read the comment docs.

@@ -61,6 +62,15 @@ func BoolArgument(name string, value bool) CliArgument {
}
}

// StringSliceArgument introduces a new string slice argument for cli context
func StringSliceArgument(name string, values ...string) CliArgument {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest adding this in the clitest test case :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants