-
Notifications
You must be signed in to change notification settings - Fork 716
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
Move to using interface for better mocking at chaoshub package #3933
Move to using interface for better mocking at chaoshub package #3933
Conversation
Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr>
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.
Clean code 🚀 Hub looks pretty refactored to me 🏆
litmus-portal/graphql-server/pkg/database/mongodb/chaoshub/operations.go
Outdated
Show resolved
Hide resolved
Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr>
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.
Minor comment, rest looks good
Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr>
Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr>
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.
LGTM! Thanks for the PR!
…schaos#3933) * fix: Move to using interface for better mocking at chaoshub Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: delete operator interface and linting codes Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: change db instance to local variable Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: passing operator interface for better mocking Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> --------- Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr>
* Migrate from Gorilla mux to Gin Signed-off-by: Namkyu Park <lak9348@gmail.com> Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * Linting & Ordering codes Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: remove duplicated code Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: adopt go fmt Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * Move to using interface for better mocking at chaoshub package (#3933) * fix: Move to using interface for better mocking at chaoshub Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: delete operator interface and linting codes Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: change db instance to local variable Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: passing operator interface for better mocking Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> --------- Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: status code to constant variable Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: add logs when encounterd error Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: rename pkg name Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: rename pkg, graphql_server to rest_handlers Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: resolve codeql issue Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: add replacer value Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> --------- Signed-off-by: Namkyu Park <lak9348@gmail.com> Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr>
Proposed changes
Currently, our Golang codebase heavily relies on concrete types for implementing functionality. It causes hard to make unit tests. So I propose an interface pattern for loose coupling like this PR. For this PR, I only targeted the chaoshub package. If this approach is correct. I will refactor all packages to the interface.
And last, The below variable will be deleted after all packages are refactored to the interface.
litmus/litmus-portal/graphql-server/pkg/database/mongodb/operations.go
Line 33 in 601da40
Issue No. #3931 #3892
Types of changes
What types of changes does your code introduce to Litmus? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Dependency
Special notes for your reviewer: @S-ayanide @amityt