-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚨 test(VSecM Sentinel): 1100 add unit test and refactor app/sentinel #1129
🚨 test(VSecM Sentinel): 1100 add unit test and refactor app/sentinel #1129
Conversation
added unit tests to app/sentinel/oidc/engine package and refactored the codebase Signed-off-by: Guray Gurkan <[email protected]>
safeOps := new(SafeClient) | ||
logger := new(RpcLogger) | ||
|
||
engine := engine.New(safeOps, logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There’s nothing inherently wrong with using new
in Go, but it’s less commonly used in idiomatic Go code because of how it behaves compared to other memory allocation patterns in Go. The new function allocates memory but doesn't initialize the object beyond setting it to its zero value.
This is in contrast to using a constructor-like approach (which can include more complex initialization logic).
Consider using safeOps := &SafeClient{}
Or if you feel Java…ey, using a custom constructor function:
func NewSafeClient() *SafeClient {
return &SafeClient{
// Initialize necessary fields here
}
}
safeOps := NewSafeClient()
Also, if you don't need a pointer to the struct, you can simply assign it directly:
safeOps := SafeClient{}
logger := RpcLogger{}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review, let me make it more goish not javaish :)
new() usage replaced with & Signed-off-by: Guray Gurkan <[email protected]>
replaced new() with more idiomatic approach using & Signed-off-by: Guray Gurkan <[email protected]>
update: there is a minor test failure in the integration server. @gurkanguray and I are investigating it. Once we fix the issue; unless anyone disagrees, we can merge this. Thanks for your contributions @gurkanguray . |
unit test fixing relating to the interface conversion Signed-off-by: Guray Gurkan <[email protected]>
Thank you @v0lkan, I believe I've fixed the issue. Ready for testing again 👍🏻 |
Increase on Coverage ratio
Description
Added unit tests to app/sentinel/oidc/engine package and refactored the codebase
Changes
List the major changes you have made in bullet points:
Test Policy Compliance
Code Quality
to understand.
Documentation
Additional Comments
Include any additional comments or context about the PR here.
Checklist
Before you submit this PR, please make sure:
especially the test policy.
under the project's license.
By submitting this pull request, you confirm that my contribution is made under
the terms of the project's license and that you have the authority to grant
these rights.
Thank you for your contribution to VMware Secrets Manager
🐢⚡️!