test(utils): add table-driven unit tests for pure helper functions - #4493
Open
SatyamPandey-07 wants to merge 3 commits into
Open
test(utils): add table-driven unit tests for pure helper functions #4493SatyamPandey-07 wants to merge 3 commits into
SatyamPandey-07 wants to merge 3 commits into
Conversation
… utils Expands table-driven unit test coverage in utils/utils_test.go for pure helper functions including IsShutdownError, ReplaceHost, ReplaceGrpcHost, ReplaceGrpcPort, ReplaceBaseURL, ReplacePort, ToInt, ToString, ToFloat, Keys, and EnsureRmBeforeName. Closes keploy#4491 Signed-off-by: Satyam Pandey <satyam53@tsecol.onmicrosoft.com>
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
The CLA check failed. Please ensure you have:
After fixing these issues, comment 'recheck' to trigger the workflow again. |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
Author
|
recheck |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
1 similar comment
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
Author
|
@prabaltripathiofficial Hi, just bumping this PR in case it slipped through your notifications. Let me know if you need any changes or further testing! |
Signed-off-by: Satyam Pandey <satyam53@tsecol.onmicrosoft.com>
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.
Describe the changes that are made
utils/utils_test.gofor multiple pure helper functions inutils/utils.go:TestIsShutdownError: tests EOF, connection reset, broken pipe, closed network connection patterns, and error exclusion.TestReplaceHost: tests URL host replacement, invalid URLs, and empty IP edge cases.TestReplaceGrpcHost&TestReplaceGrpcPort: tests authority parsing and port/host replacement with error handling.TestReplaceBaseURL: tests URL base replacement and empty/invalid base URLs.TestReplacePort: tests adding port when missing, replacing existing port, and error handling.TestToInt,TestToString,TestToFloat: tests type conversions across numeric types,json.Number, strings, and fallbacks.TestKeys: tests map key slice extraction.TestEnsureRmBeforeName: tests proper insertion of--rmbefore--namein Docker run commands without duplication.Links & References
Closes #4491
🔗 Related PRs
🐞 Related Issues
utils/utils.go#4491📄 Related Documents
What type of PR is this? (check all applicable)
Added e2e test pipeline?
Added comments for hard-to-understand areas?
Added to documentation?
Are there any sample code or steps to test the changes?
Run unit tests in the
utilspackage:go test -v ./utilsSelf Review done?
Any relevant screenshots, recordings or logs?
Additional checklist: