-
-
Notifications
You must be signed in to change notification settings - Fork 179
Add comprehensive table-driven tests with verify pattern and integration tests for internal packages #712
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
Open
Copilot
wants to merge
13
commits into
openapi
Choose a base branch
from
copilot/add-table-driven-tests
base: openapi
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add comprehensive table-driven tests with verify pattern and integration tests for internal packages #712
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d737c04
Initial plan
Copilot d63f351
Add comprehensive unit tests for internal packages
Copilot 3da19a4
Add infrastructure package tests and documentation
Copilot e78038c
Final test coverage documentation
Copilot 39dbbaa
Replace manual mocks with counterfeiter generated mocks
Copilot cec4aa9
Add integration tests using testcontainers and remove tools_test.go
Copilot 94b0bc7
Replace context.Background() with t.Context() in all tests
Copilot 97e7dce
Fix golangci-lint issues: replace custom containsString with strings.…
Copilot 944908a
Refactor tests to use verify pattern and remove internal_test.go
Copilot 95582ef
Complete rest test migration to counterfeiter mocks with verify pattern
Copilot d4fb90c
Refactor tests per code review feedback
Copilot 4a56830
Fix golangci-lint errors: unused parameters, comments, whitespace
Copilot a6defd4
Refactor integration tests per code review feedback
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package internal_test | ||
|
|
||
| // This file provides test coverage documentation for the cmd/internal package. | ||
| // | ||
| // The functions in this package (NewPostgreSQL, NewElasticsearch, NewKafka, etc.) | ||
| // are infrastructure initialization functions that: | ||
| // - Read configuration from environment variables | ||
| // - Establish connections to external services (databases, message brokers, caches) | ||
| // - Perform health checks (ping, connection tests) | ||
| // | ||
| // These functions are integration glue code that requires: | ||
| // 1. Running infrastructure (PostgreSQL, Elasticsearch, Kafka, RabbitMQ, Redis, Memcached, Vault) | ||
| // 2. Valid environment variable configuration | ||
| // 3. Network connectivity to these services | ||
| // | ||
| // Unit testing these functions would require: | ||
| // - Extensive mocking of external service clients | ||
| // - Mocking environment variable access | ||
| // - Testing error handling paths that are infrastructure-specific | ||
| // | ||
| // These are better validated through: | ||
| // - Integration tests with testcontainers | ||
| // - End-to-end tests in staging environments | ||
| // - The actual cmd applications that use these functions | ||
| // | ||
| // The functions follow a consistent pattern: | ||
| // 1. Get configuration from envvar.Configuration | ||
| // 2. Create client/connection with external service | ||
| // 3. Perform health check (ping/test connection) | ||
| // 4. Return client or error | ||
| // | ||
| // As per the requirements, we exclude "main or glue code in /cmd" from unit test coverage. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package main_test | ||
MarioCarrion marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // This file documents test coverage for cmd/rest-server/main.go | ||
| // | ||
| // The main package contains the application entry point that: | ||
| // - Loads environment variables | ||
| // - Initializes infrastructure (database, cache, message broker, search) | ||
| // - Sets up HTTP server with rate limiting and middleware | ||
| // - Starts the server | ||
| // | ||
| // As per requirements, main/entry point code in /cmd is excluded from unit test coverage. | ||
| // This code is validated through: | ||
| // - Integration tests | ||
| // - Manual testing | ||
| // - Deployment validation | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.