Skip to content

Commit

Permalink
chore: add repro script for getting started with Pact Broker and WIP …
Browse files Browse the repository at this point in the history
…[ci-skip]
  • Loading branch information
bethesque committed Jan 29, 2021
1 parent cee2a59 commit a59f19b
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions script/reproduce-issue-starting-up.rb
Original file line number Diff line number Diff line change
@@ -1,43 +1,33 @@
#!/usr/bin/env ruby

$LOAD_PATH << "#{Dir.pwd}/lib"

begin

$LOAD_PATH << "#{Dir.pwd}/lib"
require 'pact_broker/test/http_test_data_builder'
base_url = ENV['PACT_BROKER_BASE_URL'] || 'http://localhost:9292'

td = PactBroker::Test::HttpTestDataBuilder.new(base_url, { })
td.delete_integration(consumer: "MyConsumer", provider: "MyProvider")
.can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod")
.can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod")
.publish_pact(consumer: "MyConsumer", consumer_version: "1", provider: "MyProvider", content_id: "111", tag: "feature/a")
.can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod")
td = PactBroker::Test::HttpTestDataBuilder.new(base_url)
td.delete_integration(consumer: "Foo", provider: "Bar")
.delete_integration(consumer: "foo-consumer", provider: "bar-provider")
.create_pacticipant("foo-consumer")
.create_pacticipant("foo-provider")
.create_global_webhook_for_verification_published(uuid: "ba8feb17-558a-4b3f-a078-f52c6fafd014", url: "http://webhook-server:9393")
.publish_pact(consumer: "foo-consumer", consumer_version: "1", provider: "bar-provider", content_id: "111", tag: "main")
.publish_pact(consumer: "foo-consumer", consumer_version: "2", provider: "bar-provider", content_id: "111", tag: ["feat/x", "feat/y"])
.sleep(10)
.get_pacts_for_verification(
enable_pending: true,
provider_version_tag: "main",
include_wip_pacts_since: "2020-01-01",
consumer_version_selectors: [{ tag: "main", latest: true }])
consumer_version_selectors: [{ tag: "main", latest: true }, { tag: "feat/x", latest: true }, { tag: "feat/y", latest: true }])
.verify_pact(
index: 0,
provider_version_tag: "main",
provider_version: "1",
success: false
success: true
)
.get_pacts_for_verification(
enable_pending: true,
provider_version_tag: "main",
include_wip_pacts_since: "2020-01-01",
consumer_version_selectors: [{ tag: "main", latest: true }])
.can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod")
.can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod")
.deploy_to_prod(pacticipant: "MyProvider", version: "1")
.can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod")
.deploy_to_prod(pacticipant: "MyConsumer", version: "1")


rescue StandardError => e
puts "#{e.class} #{e.message}"
puts e.backtrace
exit 1
end

0 comments on commit a59f19b

Please sign in to comment.