Upgrading GraphQL to 2.3.xx requires passing correct objects in specs
There's currently an open MR from our dependency bot to upgrade graphql
from 2.3.5
to 2.3.9
While working on the upgrade from 2.3.5
to 2.3.8
I noticed a bunch of spec failures related to changes in the update e.g:
Mutations::DesignManagement::Upload#resolve when the feature is available when creating designs causes errors wraps the errors
Failure/Error: described_class.new(object: nil, context: { current_user: user }, field: nil)
NoMethodError:
undefined method `types' for {:current_user=>#<User id:959 @namespace28>}:hash
The 2.3.8
update changed the Schema::Resolver class, which uses a call to .types
on the context
object:
- self.class.arguments(context).each do |name, arg|
+ context.types.arguments(self.class).each do |arg|
The context
should be a GraphQL::Query::Context
object, but we pass a Hash
in many specs. Other graphql specs pass a GraphQL::Query::Context
object already.
I updated spec/graphql/mutations/design_management/upload_spec.rb and got the specs passing, but there are more than 800 spec failures, so any upgrade will need to address these.
UPDATE: Most specs in the spec/graphql
directory have been updated with these MRs:
There are now just 7 failures (down from 800+) on the spec/graphql
directory requiring a fix:
spec/graphql/resolvers/base_resolver_spec.rb:273
spec/graphql/resolvers/concerns/caching_array_resolver_spec.rb:197
spec/graphql/subscriptions/issuable_updated_spec.rb:23
spec/graphql/subscriptions/issuable_updated_spec.rb:30
spec/graphql/subscriptions/issuable_updated_spec.rb:38
spec/graphql/subscriptions/issuable_updated_spec.rb:47
spec/graphql/subscriptions/issuable_updated_spec.rb:54
spec/lib/gitlab/graphql/queries_spec.rb
spec/lib/gitlab/graphql/limit/field_call_count_spec.rb
Fixed with MRs
We still need to check the ee/spec/
directory.
ee/spec/graphql/mutations/ai/action_spec.rb
ee/spec/graphql/mutations/ai/duo_user_feedback_spec.rb
EE fix MRs: