Skip to content

Commit

Permalink
test open/read timeout
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Van Wiggeren <nick@planetscale.com>
  • Loading branch information
nickvanw committed May 12, 2021
1 parent 7d16ff2 commit 546b535
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spec/prometheus/client/push_spec.rb
Expand Up @@ -5,7 +5,7 @@
describe Prometheus::Client::Push do
let(:gateway) { 'http://localhost:9091' }
let(:registry) { Prometheus::Client.registry }
let(:push) { Prometheus::Client::Push.new('test-job', nil, gateway) }
let(:push) { Prometheus::Client::Push.new('test-job', nil, gateway, open_timeout: 5, read_timeout: 30) }

describe '.new' do
it 'returns a new push instance' do
Expand Down Expand Up @@ -91,6 +91,8 @@

http = double(:http)
expect(http).to receive(:use_ssl=).with(false)
expect(http).to receive(:open_timeout=).with(5)
expect(http).to receive(:read_timeout=).with(30)
expect(http).to receive(:request).with(request)
expect(Net::HTTP).to receive(:new).with('localhost', 9091).and_return(http)

Expand All @@ -104,6 +106,8 @@

http = double(:http)
expect(http).to receive(:use_ssl=).with(false)
expect(http).to receive(:open_timeout=).with(5)
expect(http).to receive(:read_timeout=).with(30)
expect(http).to receive(:request).with(request)
expect(Net::HTTP).to receive(:new).with('localhost', 9091).and_return(http)

Expand All @@ -121,6 +125,8 @@

http = double(:http)
expect(http).to receive(:use_ssl=).with(true)
expect(http).to receive(:open_timeout=).with(5)
expect(http).to receive(:read_timeout=).with(30)
expect(http).to receive(:request).with(request)
expect(Net::HTTP).to receive(:new).with('localhost', 9091).and_return(http)

Expand All @@ -140,6 +146,8 @@

http = double(:http)
expect(http).to receive(:use_ssl=).with(true)
expect(http).to receive(:open_timeout=).with(5)
expect(http).to receive(:read_timeout=).with(30)
expect(http).to receive(:request).with(request)
expect(Net::HTTP).to receive(:new).with('localhost', 9091).and_return(http)

Expand Down

0 comments on commit 546b535

Please sign in to comment.