Skip to content

Commit

Permalink
Refactor the integrations specs
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmad Tolba <tolpa1@gmail.com>
  • Loading branch information
ahmgeek committed Sep 18, 2019
1 parent 8550da5 commit e41c8b1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
10 changes: 1 addition & 9 deletions spec/prometheus/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
require 'prometheus/middleware/collector'
require 'prometheus/middleware/exporter'

API = Rack::Builder.new do
use Rack::Deflater
use Prometheus::Middleware::Collector
use Prometheus::Middleware::Exporter

map "/" do
run ->(_) { [200, {'Content-Type' => 'text/html'}, ['OK']] }
end
end
require_relative "../support/api"

describe API do
include Rack::Test::Methods
Expand Down
11 changes: 2 additions & 9 deletions spec/prometheus/threaded_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@
require 'prometheus/middleware/exporter'
require "concurrent"

API = Rack::Builder.new do
use Rack::Deflater
use Prometheus::Middleware::Collector
use Prometheus::Middleware::Exporter

map "/" do
run ->(_) { [200, {'Content-Type' => 'text/html'}, ['OK']] }
end
end
require_relative "../support/api"

describe API do
include Rack::Test::Methods
Expand Down Expand Up @@ -48,6 +40,7 @@
t4 = Thread.new do
latch.wait
res = get '/metrics'

expect(res.body).not_to be_empty
end

Expand Down
13 changes: 13 additions & 0 deletions spec/support/api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'rack'

API = Rack::Builder.new do
use Rack::Deflater
use Prometheus::Middleware::Collector
use Prometheus::Middleware::Exporter

map "/" do
run ->(_) { [200, {'Content-Type' => 'text/html'}, ['OK']] }
end
end


0 comments on commit e41c8b1

Please sign in to comment.