Skip to content

Conversation

Akshay2191
Copy link
Contributor

Implemented a function to validate the environment variables passed are part of the new v3 allowed variables if not it should throw a warning message.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@Akshay2191 Akshay2191 requested a review from a team as a code owner October 16, 2025 10:17
@github-actions github-actions bot added the chore Pull requests for routine tasks label Oct 16, 2025
@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

❌ Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.89%. Comparing base (383ce95) to head (011d5c8).

Files with missing lines Patch % Lines
internal/config/config.go 92.59% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1342      +/-   ##
==========================================
+ Coverage   84.88%   84.89%   +0.01%     
==========================================
  Files         100      100              
  Lines       14520    14547      +27     
==========================================
+ Hits        12325    12350      +25     
- Misses       1734     1735       +1     
- Partials      461      462       +1     
Files with missing lines Coverage Δ
internal/config/config.go 85.72% <92.59%> (+0.15%) ⬆️

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 383ce95...011d5c8. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Akshay2191 Akshay2191 self-assigned this Oct 17, 2025
}

func checkDeprecatedEnvVars() {
allViperKeys := make(map[string]struct{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the map structure necessary here? From what I see we could use a []string and use slices.Contains to determine if it's in the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I chose the map over slices as it will be the most performant and scalable solution. In slices, the time taken would be leaner O(n), whereas in a map, it will be constant O(1).

}
}

func runDeprecatedEnvVarsTest(t *testing.T, tc deprecatedEnvVarsTest) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this instead just be done inside the unit tests instead of splitting it up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That increases the Cyclomatic complexity of the Test function.

assert.Equal(t, expected, result)
}

type deprecatedEnvVarsTest struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be moved into the test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to define it outside as the linter gives error if we have more than 5 parameter in a function call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Pull requests for routine tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants