Skip to content

Commit

Permalink
Merge pull request #22 from Strech/add-head-deps-build
Browse files Browse the repository at this point in the history
Add support of Rack 2.2+
  • Loading branch information
Strech authored Feb 27, 2020
2 parents a1f8601 + e00c15e commit b79f374
Show file tree
Hide file tree
Showing 13 changed files with 175 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
Expand All @@ -9,6 +8,9 @@
/Gemfile.lock
/.ruby-version

# Global ignore of bundler config
.bundle/

# rspec failure tracking
.rspec_status

Expand Down
17 changes: 16 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
os: linux
language: ruby
rvm:
- 2.3.8
Expand All @@ -15,8 +16,9 @@ gemfile:
- gemfiles/sidekiq_4.x.gemfile
- gemfiles/sidekiq_5.x.gemfile
- gemfiles/sidekiq_6.x.gemfile
- gemfiles/sidekiq_head.gemfile

matrix:
jobs:
include:
- rvm: "2.6.5"
gemfile: "gemfiles/sidekiq_5.x.gemfile"
Expand All @@ -27,6 +29,19 @@ matrix:
gemfile: "gemfiles/sidekiq_6.x.gemfile"
- rvm: "2.4.9"
gemfile: "gemfiles/sidekiq_6.x.gemfile"
- rvm: "2.3.8"
gemfile: "gemfiles/sidekiq_head.gemfile"
- rvm: "2.4.9"
gemfile: "gemfiles/sidekiq_head.gemfile"
- rvm: "2.5.7"
gemfile: "gemfiles/sidekiq_head.gemfile"
- rvm: "2.6.5"
gemfile: "gemfiles/sidekiq_head.gemfile"
- rvm: "2.7.0"
gemfile: "gemfiles/sidekiq_head.gemfile"
allow_failures:
- rvm: "ruby-head"
gemfile: "gemfiles/sidekiq_head.gemfile"

cache:
directories:
Expand Down
6 changes: 6 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ appraise 'sidekiq-6.x' do
gem 'redis', '~> 4.1'
gem 'sidekiq', '~> 6.0'
end

appraise 'sidekiq-head' do
gem 'rack', '>= 2', github: 'rack/rack'
gem 'redis', '>= 4', github: 'redis/redis-rb'
gem 'sidekiq', '>= 6', github: 'mperham/sidekiq'
end
4 changes: 2 additions & 2 deletions gemfiles/sidekiq_3.3.1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ GEM
rack (2.1.2)
rack-protection (2.0.8.1)
rack
rack-test (0.8.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rainbow (3.0.0)
rake (10.5.0)
Expand Down Expand Up @@ -120,7 +120,7 @@ DEPENDENCIES
codeclimate-test-reporter (~> 1.0)
concurrent-ruby
pry-byebug (~> 3.6.0)
rack-test (~> 0.8)
rack-test (~> 1.1)
rake (~> 10.0)
redis (~> 3.3)
redis-namespace (< 1.7.0)
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/sidekiq_3.x.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ GEM
rack (2.1.2)
rack-protection (2.0.8.1)
rack
rack-test (0.8.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rainbow (3.0.0)
rake (10.5.0)
Expand Down Expand Up @@ -120,7 +120,7 @@ DEPENDENCIES
codeclimate-test-reporter (~> 1.0)
concurrent-ruby
pry-byebug (~> 3.6.0)
rack-test (~> 0.8)
rack-test (~> 1.1)
rake (~> 10.0)
redis (~> 3.3)
redis-namespace (< 1.7.0)
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/sidekiq_4.x.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ GEM
rack (2.1.2)
rack-protection (2.0.8.1)
rack
rack-test (0.8.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rainbow (3.0.0)
rake (10.5.0)
Expand Down Expand Up @@ -85,7 +85,7 @@ DEPENDENCIES
bundler (~> 2.1)
codeclimate-test-reporter (~> 1.0)
pry-byebug (~> 3.6.0)
rack-test (~> 0.8)
rack-test (~> 1.1)
rake (~> 10.0)
redis (~> 3.3)
rspec (~> 3.0)
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/sidekiq_5.x.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GEM
rack (2.1.2)
rack-protection (2.0.8.1)
rack
rack-test (0.8.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rainbow (3.0.0)
rake (10.5.0)
Expand Down Expand Up @@ -84,7 +84,7 @@ DEPENDENCIES
bundler (~> 2.1)
codeclimate-test-reporter (~> 1.0)
pry-byebug (~> 3.6.0)
rack-test (~> 0.8)
rack-test (~> 1.1)
rake (~> 10.0)
redis (~> 3.3)
rspec (~> 3.0)
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/sidekiq_6.x.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GEM
rack (2.1.2)
rack-protection (2.0.8.1)
rack
rack-test (0.8.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rainbow (3.0.0)
rake (10.5.0)
Expand Down Expand Up @@ -84,7 +84,7 @@ DEPENDENCIES
bundler (~> 2.1)
codeclimate-test-reporter (~> 1.0)
pry-byebug (~> 3.6.0)
rack-test (~> 0.8)
rack-test (~> 1.1)
rake (~> 10.0)
redis (~> 4.1)
rspec (~> 3.0)
Expand Down
9 changes: 9 additions & 0 deletions gemfiles/sidekiq_head.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rack", ">= 2", git: "https://github.com/rack/rack"
gem "redis", ">= 4", git: "https://github.com/redis/redis-rb"
gem "sidekiq", ">= 6", git: "https://github.com/mperham/sidekiq"

gemspec path: "../"
116 changes: 116 additions & 0 deletions gemfiles/sidekiq_head.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
GIT
remote: https://github.com/mperham/sidekiq
revision: 18b36dcb22163a64cf3910b1a976804675948c03
specs:
sidekiq (6.0.6)
connection_pool (>= 2.2.2)
rack (~> 2.0)
rack-protection (>= 2.0.0)
redis (>= 4.1.0)

GIT
remote: https://github.com/rack/rack
revision: 6196377654b7ff7ce7abaecea62bb285d77d53aa
specs:
rack (2.3.0)

GIT
remote: https://github.com/redis/redis-rb
revision: 41395e9a1923fe72fad8403e60cb98627d515a85
specs:
redis (4.1.3)

PATH
remote: ..
specs:
sidekiq-prometheus-exporter (0.1.12)
sidekiq (>= 3.3.1)

GEM
remote: https://rubygems.org/
specs:
appraisal (2.2.0)
bundler
rake
thor (>= 0.14.0)
ast (2.4.0)
byebug (10.0.2)
codeclimate-test-reporter (1.0.9)
simplecov (<= 0.13)
coderay (1.1.2)
connection_pool (2.2.2)
diff-lcs (1.3)
docile (1.1.5)
jaro_winkler (1.5.4)
json (2.3.0)
method_source (0.9.2)
parallel (1.19.1)
parser (2.7.0.3)
ast (~> 2.4.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.6.0)
byebug (~> 10.0)
pry (~> 0.10)
rack-protection (2.0.8.1)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rainbow (3.0.0)
rake (10.5.0)
rexml (3.2.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
rubocop (0.80.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
rexml
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-rspec (1.28.0)
rubocop (>= 0.58.0)
ruby-progressbar (1.10.1)
simplecov (0.13.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
thor (1.0.1)
timecop (0.9.1)
unicode-display_width (1.6.1)

PLATFORMS
ruby

DEPENDENCIES
appraisal (~> 2.2)
bundler (~> 2.1)
codeclimate-test-reporter (~> 1.0)
pry-byebug (~> 3.6.0)
rack (>= 2)!
rack-test (~> 1.1)
rake (~> 10.0)
redis (>= 4)!
rspec (~> 3.0)
rubocop (~> 0.58)
rubocop-rspec (~> 1.28.0)
sidekiq (>= 6)!
sidekiq-prometheus-exporter!
timecop (~> 0.9)

BUNDLED WITH
2.1.4
4 changes: 3 additions & 1 deletion lib/sidekiq/prometheus/exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ module Exporter
REQUEST_METHOD = 'REQUEST_METHOD'.freeze
NOT_FOUND_TEXT = 'Not Found'.freeze
MOUNT_PATH = '/metrics'.freeze
HEADERS = {'Content-Type' => 'text/plain; version=0.0.4', 'Cache-Control' => 'no-cache'}.freeze
# rubocop:disable Style/MutableConstant
HEADERS = {'Content-Type' => 'text/plain; version=0.0.4', 'Cache-Control' => 'no-cache'}
# rubocop:enable Style/MutableConstant
EXPORTERS = Exporters.new

class << self
Expand Down
2 changes: 1 addition & 1 deletion sidekiq-prometheus-exporter.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'bundler', '~> 2.1'
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
spec.add_development_dependency 'pry-byebug', '~> 3.6.0'
spec.add_development_dependency 'rack-test', '~> 0.8'
spec.add_development_dependency 'rack-test', '~> 1.1'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rubocop', '~> 0.58'
Expand Down
12 changes: 11 additions & 1 deletion spec/sidekiq/prometheus/exporter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
require 'spec_helper'

RSpec.describe Sidekiq::Prometheus::Exporter do
let(:app) { described_class.to_app }
let(:app) do
# Re-assemble Rack application manually
# to be able to to behave like Rack 2.2.
#
# Related: https://github.com/Strech/sidekiq-prometheus-exporter/issues/21
klass = described_class
Rack::Builder.app do
use Rack::ETag
map(klass::MOUNT_PATH) { run klass }
end
end
let(:response) { last_response }

context 'when requested metrics url' do
Expand Down

0 comments on commit b79f374

Please sign in to comment.