-
Notifications
You must be signed in to change notification settings - Fork 179
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
chore: Add Tests for GraphQL C Parser #773
Changes from all commits
d869e55
86d200e
a86ef25
87526ff
4451a54
4396a8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,8 @@ | |
'graphql.execute_multiplex' | ||
] | ||
|
||
expected_spans.delete('graphql.lex') unless trace_lex_supported? | ||
|
||
expected_result = { | ||
'simpleField' => 'Hello.', | ||
'resolvedField' => { 'originalValue' => 'testing=1', 'uppercasedValue' => 'TESTING=1' } | ||
|
@@ -103,7 +105,7 @@ | |
it 'traces the provided schemas' do | ||
SomeOtherGraphQLAppSchema.execute('query SimpleQuery{ __typename }') | ||
|
||
_(spans.size).must_equal(8) | ||
_(spans.select { |s| s.name.start_with?('graphql.') }).wont_be(:empty?) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like looking for the name rather than the quantity. Nice update. |
||
end | ||
|
||
it 'does not trace all schemas' do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,3 +125,12 @@ def uses_platform_interfaces? | |
def gem_version | ||
Gem::Version.new(GraphQL::VERSION) | ||
end | ||
|
||
# When tracing, is the parser expected to call `lex` before `parse` | ||
def trace_lex_supported? | ||
return @trace_lex_supported if defined?(@trace_lex_supported) | ||
|
||
# In GraphQL 2.2, the default parser was changed such that `lex` is no longer called | ||
@trace_lex_supported = Gem::Requirement.new('< 2.2').satisfied_by?(Gem::Version.new(GraphQL::VERSION)) \ | ||
|| (defined?(GraphQL::CParser) == 'constant') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does anything result in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test helper uses bundler require, which will load all of the declared gems by default before running any tests. In this case the Gemfile requires the graphql-c_parser file in the gems' lib directory, which requires There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end |
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.
Did you want to have one run against latest?
Perhaps could match the styles of other appraisals to the same effect.
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.
Major version changes have been difficult for us to test using appraisals, while maintaining minor versions.
We used to have canary builds that rain on unpinned versions of gems but I couldn't keep up with them so I disabled those builds.
I will however add unpinned versions of the gem to this PR and see if that puts us in a better place for the future canary work.
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.
Added here: 4451a54