-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(windows): Add retries for flakiness demonstrated on windows build…
…s for pact-go
- Loading branch information
Showing
3 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
spec/lib/pact/provider_verifier/set_up_provider_state_retry_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'pact/provider_verifier/set_up_provider_state' | ||
require 'json' | ||
require 'webmock/rspec' | ||
|
||
module Pact | ||
module ProviderVerifier | ||
describe SetUpProviderState do | ||
let(:provider_states_setup_url) { 'http://localhost:2000' } | ||
let(:provider_state) { 'some state' } | ||
let(:consumer) { 'Foo' } | ||
let(:options) { {} } | ||
|
||
subject { SetUpProviderState.call(provider_state, consumer, options) } | ||
|
||
before do | ||
ENV['PROVIDER_STATES_SETUP_URL'] = provider_states_setup_url | ||
stub_request(:any, 'http://localhost:2000').to_raise(Errno::ECONNRESET.new).times(2) | ||
.then.to_return(status: 200) | ||
end | ||
|
||
it "makes a HTTP request to the configured URL with a JSON body containing the consumer and provider state names" do | ||
subject | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'socket' | ||
|
||
server = TCPServer.new 2000 # Server bind to port 2000 | ||
loop do | ||
client = server.accept # Wait for a client to connect | ||
puts "ACCEPTED connection" | ||
client.puts "HTTP/1.1 200 OK" | ||
client.close | ||
end |