test: add unit tests for pkg/config package#199
Merged
asdek merged 2 commits intovxcontrol:feature/next_releasefrom Mar 20, 2026
Merged
test: add unit tests for pkg/config package#199asdek merged 2 commits intovxcontrol:feature/next_releasefrom
asdek merged 2 commits intovxcontrol:feature/next_releasefrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds initial unit test coverage for backend/pkg/config, focusing on NewConfig() default/env parsing behavior and ensureInstallationID() persistence/validation behavior.
Changes:
- Add unit tests for
NewConfig()defaults and selected env var overrides (URLs, provider defaults, summarizer/search defaults, CORS, Ollama). - Add unit tests for
ensureInstallationID()covering generation, reading existing IDs, and invalid-value replacement paths.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add comprehensive unit tests for NewConfig defaults, environment variable overrides, URL parsing, provider server URL defaults, summarizer defaults, search engine defaults, and ensureInstallationID logic including UUID generation, file persistence, and invalid value handling.
Add clearConfigEnv helper that clears all Config struct env vars via t.Setenv, and use t.Chdir(t.TempDir()) to isolate filesystem side effects from godotenv.Load() and ensureInstallationID(). Tests now pass regardless of environment variables set in the calling shell.
f9c19d9 to
4cffbe3
Compare
Contributor
|
thank you for the PR! |
36 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of Change
Problem: The
pkg/configpackage has no unit test coverage. This package handles all environment variable parsing, default values, URL parsing, and installation ID management for the entire application.Solution: Add 14 unit tests covering NewConfig defaults, environment variable overrides, URL parsing, provider server URL defaults, summarizer settings, search engine defaults, and all ensureInstallationID code paths (UUID generation, file read/write, invalid value handling).
Type of Change
Areas Affected
Testing and Verification
Test Configuration
Test Steps
go test ./pkg/config/... -vTest Results
Checklist
go fmtandgo vetrun