Skip to content

Update unit test coverage for tools + secret packages #85

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

Merged
merged 1 commit into from
Aug 11, 2025

Conversation

saucow
Copy link
Contributor

@saucow saucow commented Aug 5, 2025

What I did

  • Test coverage needs to be improved. CONTRIBUTING.md updated with Testing section - which contains commands for quickly understanding current coverage and snippets for analyzing integration test output

  • Increased coverage for tools package to: 58.9% from 36.0% (Note this is only for unit, integration coverage is higher)

  • Added tests for secret package. set.go coverage is now 60%

  • Note: This PR focused on adding simple tests for input criteria - subsequent test changes will tackle mocking providers where it makes sense to increase additional test coverage

Related issue

  • Currently unit-test coverage for tools is: 36.0% of statements. See screenshot below for tools package file coverage breakdown:
image
  • Additionally unit-test coverage for secret package is: 0.0%

(not mandatory) A picture of a cute animal, if possible in relation to what you did
🕸️

@saucow saucow changed the title [WIP] Update test coverage for tools package Update unit test coverage for tools + secret package Aug 6, 2025
@saucow saucow changed the title Update unit test coverage for tools + secret package Update unit test coverage for tools + secret packages Aug 6, 2025
@saucow saucow marked this pull request as ready for review August 6, 2025 14:56
@saucow saucow requested a review from a team as a code owner August 6, 2025 14:56
Copy link
Contributor

@cmrigney cmrigney left a comment

Choose a reason for hiding this comment

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

Just left one suggestion for a change, but otherwise code lgtm. Thanks for adding these!

CONTRIBUTING.md Outdated
# Run integration tests (requires Docker plugin to be installed)
make integration

# Run integration tests with console output
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Did this mean to say "unit tests"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah nice catch, updated it to remove the integration command to avoid confusion

### Unit Test Coverage

```bash
# Generate HTML coverage report for ALL packages in one view
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: I would recommend keeping all tools.go tests in a single tools_test.go file. In my experience that's golang convention for unit tests, but also I think it would make browsing go source files difficult with lots of test files bloating the filesystem. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cmrigney - good idea, we don't have many tests to begin with so let's stick with that pattern and can re-visit it as needed. Updated to keep the tests in tools_test.go

@saucow saucow requested a review from cmrigney August 9, 2025 00:43
@saucow saucow removed the request for review from slimslenderslacks August 11, 2025 14:53
Add coverage for package secret

Linter issues

Consolidate tools tests into tools test file

Clean-up test structure update contributing
@saucow saucow force-pushed the unit-test-coverage-updated branch from 9791244 to 06c9f7d Compare August 11, 2025 15:45
@saucow
Copy link
Contributor Author

saucow commented Aug 11, 2025

Note - Merging this as commit is verified and approved - seeing lingering CodeQL issue for older commits that have been squashed.
image

@saucow saucow merged commit 78cadea into docker:main Aug 11, 2025
5 checks passed
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