Skip to content

Commit

Permalink
Merge pull request #3937 from DataDog/add-missing-tests
Browse files Browse the repository at this point in the history
Add missing GraphQL and Hanami tests to CI
  • Loading branch information
TonyCTHsu committed Sep 21, 2024
2 parents 6b99807 + 32ab5e4 commit abcc3b2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 24 deletions.
18 changes: 11 additions & 7 deletions Matrixfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@
'grape' => {
'activesupport' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby'
},
'graphql' => {
'graphql-2.3' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.2' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.1' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.0' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
['graphql', 'graphql_unified_trace_patcher', 'graphql_trace_patcher', 'graphql_tracing_patcher'] => {
'graphql-2.3' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.2' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.1' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.0' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
# Although GraphQL 1.13.x depends on Ruby >= 2.4, but it does not work with Ruby 2.5
#
# require 'graphql'
Expand Down Expand Up @@ -243,7 +243,7 @@
'rails6-postgres-redis' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ❌ 3.4 / ✅ jruby',
'rails61-postgres-redis' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby'
},
'hanami' => {
['hanami', 'hanami_autoinstrument'] => {
'hanami-1' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ❌ 3.4 / ❌ jruby'
},
'sinatra' => {
Expand Down Expand Up @@ -283,7 +283,11 @@
'graphql-2.0' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-1.13' => '❌ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
}
}.freeze
}.each_with_object({}) do |(tasks, spec_metadata), hash|
Array(tasks).each do |task|
hash[task] = spec_metadata
end
end.freeze
# rubocop:enable Layout/HashAlignment

# vim: ft=ruby
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ end
desc 'Run RSpec'
# rubocop:disable Metrics/BlockLength
namespace :spec do
# REMINDER: If adding a new task here, make sure also add it to the `Matrixfile`
task all: [:main, :benchmark,
:graphql, :graphql_unified_trace_patcher, :graphql_trace_patcher, :graphql_tracing_patcher,
:rails, :railsredis, :railsredis_activesupport, :railsactivejob,
Expand Down Expand Up @@ -227,6 +228,7 @@ namespace :spec do
end

# Datadog Tracing integrations
# REMINDER: If adding a new task here, make sure also add it to the `Matrixfile`
[
:action_cable,
:action_mailer,
Expand Down
10 changes: 5 additions & 5 deletions docs/DevelopmentGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,22 @@ All tests should run in CI. When adding new `_spec.rb` files, you may need to ad
```ruby
namespace :spec do
RSpec::Core::RakeTask.new(:foo) do |t, args|
t.pattern = "spec/datadog/tracing/contrib/bar/**/*_spec.rb"
t.pattern = "spec/datadog/tracing/contrib/foo/**/*_spec.rb"
t.rspec_opts = args.to_a.join(' ')
end
end
```

- Ensure the Rake task is configured to run for the appropriate Ruby runtimes, by introducing it to our test matrix. You should find the task with `bundle exec rake -T test:<foo>`.
- Ensure the Rake task is configured to run for the appropriate Ruby runtimes, by adding it to our `Matrixfile`. You should find the task with `bundle exec rake -T test:foo` after adding it.

```ruby
TEST_METADATA = {
{
'foo' => {
# Without any appraisal group dependencies
'' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby',
# or with appraisal group definition `bar`
'bar' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby'
# or with appraisal group definition `foo-on-rails`, that includes additional gems
'foo-on-rails' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby'
},
}
```
Expand Down
12 changes: 0 additions & 12 deletions spec/datadog/tracing/contrib/graphql/tracing_patcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,5 @@
end
end
end

context 'when given something else' do
before { remove_patch!(:graphql) }

it do
expect_any_instance_of(Datadog::Core::Logger).to receive(:warn).with(/Unable to patch/)

Datadog.configure do |c|
c.tracing.instrument :graphql, with_deprecated_tracer: true, schemas: [OpenStruct.new]
end
end
end
end
end

0 comments on commit abcc3b2

Please sign in to comment.