Skip to content

Commit

Permalink
ci: Update test reset code for GraphQL-Ruby 2.1.3 (#691)
Browse files Browse the repository at this point in the history
Fixes #689
  • Loading branch information
rmosolgo authored Oct 13, 2023
1 parent 20e1cd0 commit dd90f32
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@

after do
# Reset various instance variables to clear state between tests
SomeOtherGraphQLAppSchema.instance_variable_set(:@own_tracers, [])
SomeOtherGraphQLAppSchema.instance_variable_set(:@own_plugins, SomeOtherGraphQLAppSchema.plugins[0..1])
[GraphQL::Schema, SomeOtherGraphQLAppSchema, SomeGraphQLAppSchema].each(&:_reset_tracer_for_testing)
end

it 'traces the provided schemas' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,11 @@

after do
# Reset various instance variables to clear state between tests
SomeOtherGraphQLAppSchema.instance_variable_set(:@own_tracers, [])
SomeOtherGraphQLAppSchema.instance_variable_set(:@own_plugins, SomeOtherGraphQLAppSchema.plugins[0..1])
[GraphQL::Schema, SomeOtherGraphQLAppSchema, SomeGraphQLAppSchema].each(&:_reset_tracer_for_testing)
end

it 'traces the provided schemas' do
SomeOtherGraphQLAppSchema.execute('query SimpleQuery{ __typename }')

_(spans.size).must_equal(8)
end

Expand Down
2 changes: 1 addition & 1 deletion instrumentation/graphql/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module SchemaTestPatches
# Reseting @graphql_definition is needed for tests running against version `1.9.x`
# Other variables are used by ~> 2.0.19
def _reset_tracer_for_testing
%w[own_tracers trace_modes trace_class tracers graphql_definition].each do |ivar|
%w[own_tracers trace_modes trace_class tracers graphql_definition own_trace_modes].each do |ivar|
remove_instance_variable("@#{ivar}") if instance_variable_defined?("@#{ivar}")
end
end
Expand Down

0 comments on commit dd90f32

Please sign in to comment.