Skip to content

test: fuzz test schema exec #666

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

Merged
merged 4 commits into from
May 24, 2025
Merged

test: fuzz test schema exec #666

merged 4 commits into from
May 24, 2025

Conversation

pavelnikolov
Copy link
Member

Add fuzz testing for schema execution and error early for executable documents without any operations.

@pavelnikolov pavelnikolov requested a review from Copilot May 24, 2025 13:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds fuzz testing for GraphQL schema execution and introduces an early error when an executable document has no operations.

  • Adds a guard in ValidateWithVariables to return an error if the parsed document contains zero operations.
  • Introduces FuzzSchema_Exec in fuzz_test.go with a set of seed queries and fuzz logic to validate execution behavior.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
graphql.go Early return of a QueryError when doc.Operations is empty
fuzz_test.go New fuzz test FuzzSchema_Exec to exercise Exec paths
Comments suppressed due to low confidence (2)

fuzz_test.go:20

  • You may want to add a seed input containing only fragment definitions (no operations) to ensure the new early-error path in ValidateWithVariables is exercised by the fuzzer.
queries := []string{

fuzz_test.go:11

  • [nitpick] Consider renaming FuzzSchema_Exec to FuzzSchemaExec (dropping the underscore) to match Go fuzz test naming conventions.
func FuzzSchema_Exec(f *testing.F) {

pavelnikolov and others added 3 commits May 24, 2025 23:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@pavelnikolov pavelnikolov merged commit f73d124 into master May 24, 2025
4 checks passed
@pavelnikolov pavelnikolov mentioned this pull request May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant