Skip to content

test: add fuzz tests for chaos experiment run MongoDB operator#5545

Open
jaehyyuun wants to merge 2 commits into
litmuschaos:masterfrom
jaehyyuun:test/fuzz-chaos-experiment-run-mongodb-operator
Open

test: add fuzz tests for chaos experiment run MongoDB operator#5545
jaehyyuun wants to merge 2 commits into
litmuschaos:masterfrom
jaehyyuun:test/fuzz-chaos-experiment-run-mongodb-operator

Conversation

@jaehyyuun

Copy link
Copy Markdown

Proposed changes

Fixes #5544

Add fuzz tests for MongoDB operator functions in the chaos experiment run package.

The following functions in
chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment_run/operations.go are covered:

  • CreateExperimentRun
  • GetExperimentRun
  • GetExperimentRuns
  • UpdateExperimentRun
  • UpdateExperimentRunWithQuery
  • UpdateExperimentRunsWithQuery
  • GetExperimentRunsByInfraID
  • GetAggregateExperimentRuns

Types of changes

What types of changes does your code introduce to Litmus? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices applies)

Checklist

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.

  • I have read the CONTRIBUTING doc
  • I have signed the commit for DCO to be passed.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)

Dependency

None

Special notes for your reviewer:

Fuzz tests follow the existing patterns in:

  • chaoscenter/graphql/server/pkg/chaos_experiment_run/handler/fuzz_tests/handler_fuzz_test.go
  • chaoscenter/graphql/server/pkg/chaos_experiment_run/fuzz_tests/service_fuzz_test.go

To verify the tests pass:

cd chaoscenter/graphql/server
go test ./pkg/database/mongodb/chaos_experiment_run/fuzz_tests/...

To run a specific fuzz target:

go test ./pkg/database/mongodb/chaos_experiment_run/fuzz_tests/... -run=FuzzCreateExperimentRun -fuzz=FuzzCreateExperimentRun -fuzztime=30s

Signed-off-by: jaehyun jeong <jaehyunj393@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Go fuzz tests to improve robustness coverage for the MongoDB chaos experiment run operator layer (operations.go) by exercising its public CRUD/query methods with arbitrary inputs using the existing AdaLogics fuzzing pattern already present in the repo.

Changes:

  • Introduces operator_fuzz_test.go with fuzz targets for the chaos experiment run MongoDB operator methods.
  • Mocks the MongoDB operator calls to keep fuzz targets deterministic and focused on “no panic” behavior for malformed inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add fuzz tests for chaos experiment run MongoDB operator

4 participants