-
Notifications
You must be signed in to change notification settings - Fork 703
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/chaos experiments: Tests for handlers and services #4137
Test/chaos experiments: Tests for handlers and services #4137
Conversation
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
…est/chaos-exps
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: Soham Ratnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
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.
Hello @SohamRatnaparkhi, Can you rename choas
to chaos
and check that all the test cases work, please?
chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler_test.go
Outdated
Show resolved
Hide resolved
chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler_test.go
Outdated
Show resolved
Hide resolved
chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler_test.go
Outdated
Show resolved
Hide resolved
Hey @namkyu1999 So, in this PR itself, should I add them to the chaos_experiment_runs folder? There are failing testcases, but the reason they are failing is because the chaos_experiment_runs package doesn't have any mocks. |
Hey @SohamRatnaparkhi , |
Okay cool! |
Right 😊 |
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Hey @namkyu1999 In a separate PR, we can do 2 things
What's your opinion on this? |
Hi @SohamRatnaparkhi , Since there aren't many changes in the current PR, and no one has started a review, it would be a good idea to include all the changes in this PR. This is just my opinion, feel free to make your own choices. |
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Hey @namkyu1999 |
} | ||
} | ||
|
||
func TestChaosExperimentHandler_UpdateChaosExperiment(t *testing.T) { |
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.
This testcase is failed because new operations added since last commit.
UpdateChaosExperiment
use this function below
litmus/chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler.go
Lines 248 to 251 in 794676f
experimentCount, err := c.chaosExperimentOperator.CountChaosExperiments(ctx, filterQuery) | |
if err != nil { | |
return nil, err | |
} |
and this operator use a global variable
litmus/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment/operations.go
Line 130 in 794676f
res, err := mongodb.Operator.CountDocuments(ctx, mongodb.ChaosExperimentCollection, query) |
Can you change this one to local variable and update testcase?
Other than that, LGTM 🚀
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.
Made the changes in latest commit!
Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
Signed-off-by: Saranya Jena <saranya.jena@harness.io>
Signed-off-by: Saranya Jena <saranya.jena@harness.io>
Proposed changes
Closes #4050
This PR consists tests for handlers and services in choas_experiment package
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:
This PR is related to LFX Mentorship-Term2