From 7044a5a59ab561d7757df61f4d9b8af6950b11f2 Mon Sep 17 00:00:00 2001 From: JustSnow Date: Mon, 19 Nov 2018 17:49:37 +0300 Subject: [PATCH] add tests --- Appraisals | 4 ++++ Rakefile | 6 +++++- spec/ddtrace/contrib/shoryuken/patcher_spec.rb | 12 ++++++++++++ .../contrib/shoryuken/shoryuken_spec_helper.rb | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 spec/ddtrace/contrib/shoryuken/patcher_spec.rb create mode 100644 spec/ddtrace/contrib/shoryuken/shoryuken_spec_helper.rb diff --git a/Appraisals b/Appraisals index 9cf3ae85f89..790ecc67bce 100644 --- a/Appraisals +++ b/Appraisals @@ -274,6 +274,7 @@ elsif Gem::Version.new('2.1.0') <= Gem::Version.new(RUBY_VERSION) \ gem 'rest-client' gem 'resque', '< 2.0' gem 'sequel', '~> 4.0', '< 4.37' + gem 'shoryuken' gem 'sidekiq', '~> 3.5.4' gem 'sinatra', '1.4.5' gem 'sqlite3' @@ -413,6 +414,7 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \ gem 'rest-client' gem 'resque', '< 2.0' gem 'sequel' + gem 'shoryuken' gem 'sidekiq' gem 'sinatra' gem 'sqlite3' @@ -551,6 +553,7 @@ elsif Gem::Version.new('2.3.0') <= Gem::Version.new(RUBY_VERSION) \ gem 'rest-client' gem 'resque', '< 2.0' gem 'sequel' + gem 'shoryuken' gem 'sidekiq' gem 'sinatra' gem 'sqlite3' @@ -583,6 +586,7 @@ elsif Gem::Version.new('2.4.0') <= Gem::Version.new(RUBY_VERSION) gem 'rest-client' gem 'resque', '< 2.0' gem 'sequel' + gem 'shoryuken' gem 'sidekiq' gem 'sinatra' gem 'sqlite3' diff --git a/Rakefile b/Rakefile index d36dd85fda7..0224ad59790 100644 --- a/Rakefile +++ b/Rakefile @@ -75,7 +75,8 @@ namespace :spec do :sidekiq, :sinatra, :sucker_punch, - :rest_client + :rest_client, + :shoryuken ].each do |contrib| RSpec::Core::RakeTask.new(contrib) do |t| t.pattern = "spec/ddtrace/contrib/#{contrib}/**/*_spec.rb" @@ -361,6 +362,7 @@ task :ci do sh 'bundle exec appraisal contrib rake spec:resque' sh 'bundle exec appraisal contrib rake spec:rest_client' sh 'bundle exec appraisal contrib rake spec:sequel' + sh 'bundle exec appraisal contrib rake spec:shoryuken' # Rails minitests sh 'bundle exec appraisal contrib rake test:sidekiq' sh 'bundle exec appraisal rails30-postgres rake test:rails' @@ -426,6 +428,7 @@ task :ci do sh 'bundle exec appraisal contrib rake spec:resque' sh 'bundle exec appraisal contrib rake spec:rest_client' sh 'bundle exec appraisal contrib rake spec:sequel' + sh 'bundle exec appraisal contrib rake spec:shoryuken' # Rails minitests sh 'bundle exec appraisal contrib rake test:sidekiq' sh 'bundle exec appraisal rails30-postgres rake test:rails' @@ -490,6 +493,7 @@ task :ci do sh 'bundle exec appraisal contrib rake spec:resque' sh 'bundle exec appraisal contrib rake spec:rest_client' sh 'bundle exec appraisal contrib rake spec:sequel' + sh 'bundle exec appraisal contrib rake spec:shoryuken' # Rails minitests sh 'bundle exec appraisal contrib rake test:sidekiq' sh 'bundle exec rake benchmark' diff --git a/spec/ddtrace/contrib/shoryuken/patcher_spec.rb b/spec/ddtrace/contrib/shoryuken/patcher_spec.rb new file mode 100644 index 00000000000..f90fbd8ab02 --- /dev/null +++ b/spec/ddtrace/contrib/shoryuken/patcher_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' +require 'spec/ddtrace/contrib/shoryuken/shoryuken_spec_helper' + +RSpec.describe Datadog::Contrib::Shoryuken::Patcher do + describe '.patch' do + subject { Shoryuken.server_middleware.entries.map(&:klass) } + + before { described_class.patch } + + it { is_expected.to include Datadog::Contrib::Shoryuken::Tracer } + end +end diff --git a/spec/ddtrace/contrib/shoryuken/shoryuken_spec_helper.rb b/spec/ddtrace/contrib/shoryuken/shoryuken_spec_helper.rb new file mode 100644 index 00000000000..9e055f22647 --- /dev/null +++ b/spec/ddtrace/contrib/shoryuken/shoryuken_spec_helper.rb @@ -0,0 +1,4 @@ +require 'ddtrace' +require 'shoryuken' +require 'ddtrace/contrib/shoryuken/tracer' +require 'ddtrace/contrib/shoryuken/integration'