graph-gophers / graphql-go

GraphQL server with a focus on ease of use
BSD 2-Clause "Simplified" License
4.64k stars 491 forks source link

Fix Flaky Order of Directive Validation #635

Closed dackroyd closed 5 months ago

dackroyd commented 5 months ago

Due to the use of a map behind the directiveNames, iterating over them is done in random order. When there are multiple directives that are duplicated, the order of errors can change between runs, and be inconsistent with the expecated result.

This issue is also the case for other types which use a map to validate names, however the other cases currently have no tests validating this condition. To resolve the immediate issue of flaky tests, addressing just the directives case for now. Resolution of other cases should be accompanied by tests exposing the issue.