From 0b27841fd61e97388c6b645d5812e8a06be567a3 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Fri, 10 May 2019 11:03:25 -0500 Subject: Eager load the GraphQL schema in specs Avoid counting on Rails eager loading the GraphQL types, but preload them before the specs. This would avoid loading the schema in 2 separate threads concurrently (1 inside the specs, 1 inside the test-server that will receive requests). Loading the schema in parallel like that could cause duplicate definition errors. --- spec/support/helpers/graphql_helpers.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb index f15944652fd..44ed9da25fc 100644 --- a/spec/support/helpers/graphql_helpers.rb +++ b/spec/support/helpers/graphql_helpers.rb @@ -197,3 +197,7 @@ module GraphqlHelpers allow(GitlabSchema).to receive(:max_query_depth).with(any_args).and_return nil end end + +# This warms our schema, doing this as part of loading the helpers to avoid +# duplicate loading error when Rails tries autoload the types. +GitlabSchema.graphql_definition -- cgit v1.2.3