Add hosts file validation for mappings#67
Draft
evg4b wants to merge 3 commits into
Draft
Conversation
5df326d to
dd38c7c
Compare
- Add hosts file reader to check system hosts file entries - Add validator to check that hosts from mappings point to localhost - Display warning if mapping host is not found in hosts file - Skip wildcard hostnames in validation - Add tests for hosts reader and validator
- Use afero.Fs instead of direct os.Open for better testability - Pass filesystem as dependency to ReadHostsFile and ValidateHostsFileEntries - Add comprehensive tests using afero.MemMapFs - Improve test coverage with mock filesystem scenarios
- Add constant for minimum hosts file fields to fix magic number warning - Use require.Error instead of assert.Error for error assertions - Add test case with different hosts file content to fix unparam warning - Add test case for existing host in hosts file
dd38c7c to
f9edc48
Compare
|
5711115 to
ff88be9
Compare
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
Type of Change
Related Issues
Motivation and Context
How Has This Been Tested?
Test Configuration:
Screenshots (if applicable)
Checklist
Code Quality
make formatto format my codegolangci-lint runand resolved all issuesTesting
make testand all tests passmake test-coverand maintained or improved code coverageDocumentation
Dependencies
go mod tidyto clean up dependenciesBreaking Changes
Additional Notes
For Reviewers
Areas that need special attention:
Known issues or limitations:
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT License and I have read and followed the Contributing Guidelines.