diff --git a/example/animal-service/Gemfile b/example/animal-service/Gemfile index f031cedc..db639d15 100644 --- a/example/animal-service/Gemfile +++ b/example/animal-service/Gemfile @@ -7,7 +7,7 @@ group :development, :test do end gem 'rake' -gem 'rack', '~> 2.2', '>= 2.2.3.1' +gem 'rack', '~> 2.2', '>= 2.2.6.4' gem 'sqlite3' gem 'sequel' -gem 'sinatra', '>= 2.2.3' +gem 'sinatra' diff --git a/example/animal-service/Gemfile.lock b/example/animal-service/Gemfile.lock index ebe450f6..6c1fd3c0 100644 --- a/example/animal-service/Gemfile.lock +++ b/example/animal-service/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - pact (1.62.0) + pact (1.63.0) pact-mock_service (~> 3.0, >= 3.3.1) pact-support (~> 1.16, >= 1.16.9) rack-test (>= 0.6.3, < 3.0.0) @@ -20,11 +20,12 @@ GEM parslet filelock (1.1.1) find_a_port (1.0.1) - json (2.6.2) + json (2.6.3) method_source (1.0.0) - mustermann (2.0.2) + mini_portile2 (2.8.2) + mustermann (3.0.0) ruby2_keywords (~> 0.0.1) - pact-mock_service (3.10.0) + pact-mock_service (3.11.0) filelock (~> 1.1) find_a_port (~> 1.0.1) json @@ -34,51 +35,52 @@ GEM term-ansicolor (~> 1.0) thor (>= 0.19, < 2.0) webrick (~> 1.3) - pact-support (1.18.1) + pact-support (1.19.0) awesome_print (~> 1.9) diff-lcs (~> 1.4) expgen (~> 0.1) rainbow (~> 3.1.1) parslet (2.0.0) - pry (0.14.1) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - rack (2.2.4) - rack-protection (2.2.2) + rack (2.2.7) + rack-protection (3.0.6) rack - rack-test (2.0.2) + rack-test (2.1.0) rack (>= 1.3) rainbow (3.1.1) rake (13.0.6) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-support (3.11.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.0) ruby2_keywords (0.0.5) - sequel (5.59.0) - sinatra (2.2.2) - mustermann (~> 2.0) - rack (~> 2.2) - rack-protection (= 2.2.2) + sequel (5.68.0) + sinatra (3.0.6) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.0.6) tilt (~> 2.0) - sqlite3 (1.4.4) + sqlite3 (1.6.2) + mini_portile2 (~> 2.8.0) sync (0.5.0) term-ansicolor (1.7.1) tins (~> 1.0) thor (1.2.1) - tilt (2.0.11) - tins (1.31.1) + tilt (2.1.0) + tins (1.32.1) sync - webrick (1.7.0) + webrick (1.8.1) PLATFORMS ruby @@ -86,11 +88,11 @@ PLATFORMS DEPENDENCIES pact! pry - rack (~> 2.2, >= 2.2.3.1) + rack (~> 2.2, >= 2.2.6.4) rake rspec sequel - sinatra (>= 2.2.0) + sinatra sqlite3 BUNDLED WITH diff --git a/example/zoo-app/Gemfile b/example/zoo-app/Gemfile index 61b86165..cc3efbf3 100644 --- a/example/zoo-app/Gemfile +++ b/example/zoo-app/Gemfile @@ -8,5 +8,6 @@ group :development, :test do end gem 'rake' -gem 'rack', '~>2.2' -gem 'httparty' + +gem 'rack', '~> 2.2', '>= 2.2.6.4' +gem 'httparty', '>= 0.21.0' \ No newline at end of file diff --git a/example/zoo-app/Gemfile.lock b/example/zoo-app/Gemfile.lock index 856901f0..26fe7abf 100644 --- a/example/zoo-app/Gemfile.lock +++ b/example/zoo-app/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - pact (1.62.0) + pact (1.63.0) pact-mock_service (~> 3.0, >= 3.3.1) pact-support (~> 1.16, >= 1.16.9) rack-test (>= 0.6.3, < 3.0.0) @@ -21,16 +21,14 @@ GEM parslet filelock (1.1.1) find_a_port (1.0.1) - httparty (0.20.0) - mime-types (~> 3.0) + httparty (0.21.0) + mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - json (2.6.2) + json (2.6.3) method_source (1.0.0) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) + mini_mime (1.1.2) multi_xml (0.6.0) - pact-mock_service (3.10.0) + pact-mock_service (3.11.0) filelock (~> 1.1) find_a_port (~> 1.0.1) json @@ -40,48 +38,48 @@ GEM term-ansicolor (~> 1.0) thor (>= 0.19, < 2.0) webrick (~> 1.3) - pact-support (1.18.1) + pact-support (1.19.0) awesome_print (~> 1.9) diff-lcs (~> 1.4) expgen (~> 0.1) rainbow (~> 3.1.1) - pact_broker-client (1.51.1) + pact_broker-client (1.66.1) dig_rb (~> 1.0) - httparty (~> 0.18) + httparty (>= 0.21.0, < 1.0.0) rake (~> 13.0) table_print (~> 1.5) term-ansicolor (~> 1.7) thor (>= 0.20, < 2.0) parslet (2.0.0) - pry (0.14.1) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - rack (2.2.4) - rack-test (2.0.2) + rack (2.2.7) + rack-test (2.1.0) rack (>= 1.3) rainbow (3.1.1) rake (13.0.6) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-support (3.11.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.0) sync (0.5.0) table_print (1.5.7) term-ansicolor (1.7.1) tins (~> 1.0) thor (1.2.1) - tins (1.31.1) + tins (1.32.1) sync - webrick (1.7.0) + webrick (1.8.1) PLATFORMS ruby diff --git a/tasks/foo-bar.rake b/tasks/foo-bar.rake index ebe3129c..f2ab505d 100644 --- a/tasks/foo-bar.rake +++ b/tasks/foo-bar.rake @@ -2,10 +2,10 @@ require 'pact/tasks/verification_task' require 'faraday' # Use for end to end manual debugging of issues. -BROKER_BASE_URL = 'http://localhost:9292' -#BROKER_BASE_URL = 'https://test.pact.dius.com.au' +BROKER_BASE_URL = ENV.fetch('PACT_BROKER_BASE_URL', 'http://localhost:9292') BROKER_USERNAME = ENV['PACT_BROKER_USERNAME'] BROKER_PASSWORD = ENV['PACT_BROKER_PASSWORD'] +BROKER_TOKEN = ENV['PACT_BROKER_TOKEN'] RSpec::Core::RakeTask.new('pact:foobar:create') do | task | task.pattern = "spec/features/foo_bar_spec.rb" @@ -19,11 +19,13 @@ task 'pact:foobar:publish' do put_request['Content-Type'] = "application/json" put_request.body = File.read("spec/pacts/foo-bar.json") put_request.basic_auth(BROKER_USERNAME, BROKER_PASSWORD) if BROKER_USERNAME + put_request['Authorization'] = "Bearer #{BROKER_TOKEN}" if BROKER_TOKEN response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: BROKER_BASE_URL.start_with?('https')) do |http| http.request put_request end puts response.code unless response.code == '200' + # TODO put auth in these requests tag_response = Faraday.put("#{BROKER_BASE_URL}/pacticipants/Foo/versions/1.0.0/tags/dev", nil, { 'Content-Type' => 'application/json' }) puts tag_response.status unless tag_response.status == 200 tag_response = Faraday.put("#{BROKER_BASE_URL}/pacticipants/Foo/versions/1.0.0/tags/prod", nil, { 'Content-Type' => 'application/json' }) @@ -41,11 +43,11 @@ Pact::VerificationTask.new('foobar:wip') do | pact | end Pact::VerificationTask.new(:foobar_using_broker) do | pact | - pact.uri nil, :pact_helper => './spec/support/bar_pact_helper.rb', username: BROKER_USERNAME, password: BROKER_PASSWORD + pact.uri nil, :pact_helper => './spec/support/bar_pact_helper.rb', username: BROKER_USERNAME, password: BROKER_PASSWORD, token: BROKER_TOKEN end Pact::VerificationTask.new('foobar_using_broker:fail') do | pact | - pact.uri "#{BROKER_BASE_URL}/pacts/provider/Bar/consumer/Foo/version/1.0.0", :pact_helper => './spec/support/bar_fail_pact_helper.rb', username: BROKER_USERNAME, password: BROKER_PASSWORD + pact.uri "#{BROKER_BASE_URL}/pacts/provider/Bar/consumer/Foo/version/1.0.0", :pact_helper => './spec/support/bar_fail_pact_helper.rb', username: BROKER_USERNAME, password: BROKER_PASSWORD, token: BROKER_TOKEN end task 'pact:verify:foobar' => ['pact:foobar:create']