-
Notifications
You must be signed in to change notification settings - Fork 493
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
adding fuzz tests #392
base: master
Are you sure you want to change the base?
adding fuzz tests #392
Conversation
This is a great idea @jveiga ! Now that we have official fuzz support in Go 1.18, would you be willing to update the PR to use that? Of course, we would need to wait for a few weeks for it to be released, but in the meanwhile we can start migrating this PR. Any thoughts? |
Yes, indeed the fuzz testing is an amazing idea. Looking forward to Go 1.18. |
That's a great approach. I would ask then which functions to fuzz.
This kind of fuzzing is easier to do with go-fuzz which I can also add an integration with. I will see what kind of features go 1.18 will support and update this branch with findings |
7e6fe4d
to
f0e0852
Compare
I think |
The real value would come from fuzzing the |
f0e0852
to
f5cd8ab
Compare
updated with Feel free to add more methods to the implementation of Also, I realised that calling fuzz stores a local folder with regressions like ❯ tree testdata
testdata
└── fuzz
└── FuzzSchemaExec
├── 671f05b72e69d643e6570ec3777c27147cb4ec551090f2d71ce1c4db1010c686
└── c843983602e04670a35adb41fb79674de6dd362f431acf11c4f8f6fe7a78df84 Should I add these folders to |
f5cd8ab
to
ea9d3be
Compare
ea9d3be
to
3df64df
Compare
func FuzzParse(f *testing.F){ | ||
f.Fuzz(func(t *testing.T, schemaString string, useStringDescriptions bool){ | ||
s := schema.New() | ||
schema.Parse(s, schemaString, useStringDescriptions) |
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.
When using string descriptions the syntax changes. So maybe we'll end up with a bunch of syntax errors which are expected. I wonder how beneficial is such a test. As in what are the type of errors that we could catch and prevent.
@pavelnikolov running random inputs helps finding unexpected bugs, out of bounds errors, logic errors, etc. |
I guess we'll have to wait for Go 1.18 to be released early in 2022 to merge this PR |
referencing #386
Added Fuzz tests for
query.Parse
andquery.Parse
.How to run with gotip and run
Note that calling trying to call test fuzz with multiple matching tests will fail with
gotip test --fuzz=Fuzz ./internal/... cannot use -fuzz flag with multiple packages