Conversation
There was a problem hiding this comment.
Pull Request Overview
Prevents the Load() function from overwriting previously set configuration values by adding existence checks before setting values in the config maps. This ensures that once a value is loaded or written, subsequent Load() calls preserve the original value.
- Added existence checks in the
Load()function for all supported data types - Created new test fixture to isolate test cases and prevent interference between subtests
- Added comprehensive test coverage for the new non-overwrite behavior across all data types
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| configura.go | Modified Load() function to check if key exists before setting values, preventing overwrites |
| configura_test.go | Added test isolation and comprehensive test suite for non-overwrite behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Golang Build & Test status 🚀Go Test Outcome 🧪
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
Fixed an issue where calling
Load()multiple times would overwrite previously set configuration values. Now theLoadfunction checks if a key already exists in the config maps before setting it, ensuring that once a value is loaded or written, subsequentLoadcalls won't override it.This maintains the expected behavior where the first value loaded (whether from environment variables or fallback) takes priority, and prevents accidental overwrites from multiple
Loadcalls on the same key.