Hazem Borham
03/07/2023, 5:03 PMfor-verification
pacts, however we have a pending pact to be verified on a feature branch for both the consumer and provider.Hazem Borham
03/07/2023, 5:13 PMfor-verification
results using these steps. Env is pact-go 2.x.x and using 3.0 spec.
Steps to debug:
1. pact-go provider-verification, set log level to DEBUG
, this gave the output:
Sending JSON to https://[redacted].<http://pactflow.io/pacts/provider/[Redacted]Service/for-verification|pactflow.io/pacts/provider/[Redacted]Service/for-verification> using POST: {"providerVersionTags":[],"includePendingStatus":true,"includeWipPactsSince":"2022-04-15T00:00:00Z","consumerVersionSelectors":[{"mainBranch":true},{"matchingBranch":true},{"deployedOrReleased":true}],"providerVersionBranch":"main"}
2. Posted in the HAL Browser and received no results
3. Confirmed in the HAL Browser that pacts exist,
https://[redacted].<http://pactflow.io/pacts/provider/[Redacted]Service|pactflow.io/pacts/provider/[Redacted]Service>
Matt (pactflow.io / pact-js / pact-go)
Hazem Borham
03/07/2023, 10:16 PMfeature/fun-123
with a new provider "BarService".
a. BarService does not have any real pacts on main branch
2. Use CI to publish the pact with branch=feature/fun-123
3. New integration exists between FooService pact open link BarService
a. The newly published pact in unverified, so I'd call this pending
4. BarService implements the verification on like named branch, eg feature/fun-123
5. Provider CI executes on feature branch
a. Provider Verification Configuration
i. ConsumerSelectors
1. mainBranch = true
2. matchBranch = true
3. deployedOrReleased = true
ii. IncludePendingStatus = true
iii. IncludeWipPactsSince = yep
b. for-verification
api returns the new pact
c. Verification is success.
d. can-i-deploy is a success
6. Provider merge to main
a. Repeat 5a and 5b on main branch
i. for-verification
does not find any pacts to verify
b. can-i-deploy fails due to no successful verifications on main branch
At 5c, I would think the pact although first verified is still consider pending and therefore should be returned in for-verification
api given the provider verification configuration. Even if it's WIP at this point it is still pending or at least I thought.
I think my work-around is to delete the verification on the initial provider feature branch to put the pact back in unverified. I did this with a clone existing and used the same query on a provider main branch and was able to get back a pact requiring verification.Hazem Borham
03/07/2023, 10:17 PM#00544115
Hazem Borham
03/07/2023, 11:18 PMMain Branch: main
Matt (pactflow.io / pact-js / pact-go)
Hazem Borham
03/08/2023, 1:31 AMHazem Borham
03/08/2023, 1:32 AMHazem Borham
03/08/2023, 1:32 AMMatt (pactflow.io / pact-js / pact-go)
Interesting, so had my main branch verification found a for-verification pact and verified then this would get set.only on the provider To set it on the consumer, it’s when the contract is published (or if explicitly set)
Matt (pactflow.io / pact-js / pact-go)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
2023-03-30 11:42:44.975904 D [37431:13260] [wip] PactBroker::Pacts::PactsForVerificationRepository -- Potential WIP pacts for provider branch main created after 2020-01-01T00:00:00+00:00 by consumer branch -- ["FooService 2 (branch feature/fun-123)"]
2023-03-30 11:42:44.976124 D [37431:13260] [wip] PactBroker::Pacts::PactsForVerificationRepository -- Potential WIP pacts for provider branch main created after 2020-01-01T00:00:00+00:00 by consumer tag (none)
2023-03-30 11:42:44.976474 D [37431:13260] [wip] PactBroker::Pacts::PactsForVerificationRepository -- Ignoring pacts explicitly specified in the selectors (none)
2023-03-30 11:42:44.976793 D [37431:13260] [wip] PactBroker::Pacts::PactsForVerificationRepository -- Ignoring pacts successfully verified by this provider branch when not WIP (none)
2023-03-30 11:42:44.977383 D [37431:13260] [wip] PactBroker::Pacts::PactsForVerificationRepository -- Ignoring pacts successfully verified by another provider branch when not WIP -- ["FooService 2 (branch feature/fun-123)"]
2023-03-30 11:42:44.978735 D [37431:13260] [wip] PactBroker::Pacts::PactsForVerificationRepository -- Ignoring pacts explicitly specified in the selectors (none)
2023-03-30 11:42:44.979048 D [37431:13260] [wip] PactBroker::Pacts::PactsForVerificationRepository -- Ignoring pacts successfully verified by this provider branch when not WIP (none)
2023-03-30 11:42:44.979434 D [37431:13260] [wip] PactBroker::Pacts::PactsForVerificationRepository -- Ignoring pacts successfully verified by another provider branch when not WIP (none)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
#!/usr/bin/env ruby
# The content_id is used to deterministically generate pact content. It doesn't matter what the value is.
# If you want to simulate publishing a pact that has the same content as a previous pact, use the same ID.
# If you want to simulate publishing a pact with different content, use a different ID.
#!/usr/bin/env ruby
# The content_id is used to deterministically generate pact content. It doesn't matter what the value is.
# If you want to simulate publishing a pact that has the same content as a previous pact, use the same ID.
# If you want to simulate publishing a pact with different content, use a different ID.
require "bundler/inline"
gemfile do
source "<https://rubygems.org>"
gem "faraday"
end
begin
$LOAD_PATH << "#{Dir.pwd}/lib"
require "pact_broker/test/http_test_data_builder"
base_url = ENV["PACT_BROKER_BASE_URL"] || "<http://localhost:9292>"
CONSUMER = "FooService"
PROVIDER = "BarService"
td = PactBroker::Test::HttpTestDataBuilder.new(base_url)
td.delete_pacticipant(CONSUMER)
.delete_pacticipant(PROVIDER)
.create_pacticipant(CONSUMER, main_branch: "main")
.publish_contract(consumer: CONSUMER, consumer_version: "2", provider: PROVIDER, content_id: "111", branch: "feature/fun-123")
.get_pacts_for_verification(
provider: PROVIDER,
enable_pending: true,
provider_version_branch: "feature/fun-123",
include_wip_pacts_since: "2020-01-01",
consumer_version_selectors: [{ mainBranch: true }, { matchingBranch: true } , { deployedOrReleased: true }]
)
.verify_pact(
index: 0,
provider_version_branch: "feature/fun-123",
provider_version: "2",
success: true
)
.can_i_deploy(pacticipant: PROVIDER, version: "2", to_environment: "test")
.get_pacts_for_verification(
provider: PROVIDER,
enable_pending: true,
provider_version_branch: "main",
include_wip_pacts_since: "2020-01-01",
consumer_version_selectors: [{ mainBranch: true }, { matchingBranch: true } , { deployedOrReleased: true }]
)
rescue StandardError => e
puts "#{e.class} #{e.message}"
puts e.backtrace
exit 1
end
Beth (pactflow.io/Pact Broker/pact-ruby)
{ matchingBranch: true }
selector, and only rely on WIP to bring in that pact, then I still get the pact as WIP on the main branch.Beth (pactflow.io/Pact Broker/pact-ruby)
#!/usr/bin/env ruby
# The content_id is used to deterministically generate pact content. It doesn't matter what the value is.
# If you want to simulate publishing a pact that has the same content as a previous pact, use the same ID.
# If you want to simulate publishing a pact with different content, use a different ID.
require "bundler/inline"
gemfile do
source "<https://rubygems.org>"
gem "faraday"
end
begin
$LOAD_PATH << "#{Dir.pwd}/lib"
require "pact_broker/test/http_test_data_builder"
base_url = ENV["PACT_BROKER_BASE_URL"] || "<http://localhost:9292>"
CONSUMER = "FooService"
PROVIDER = "BarService"
td = PactBroker::Test::HttpTestDataBuilder.new(base_url)
td.delete_pacticipant(CONSUMER)
.delete_pacticipant(PROVIDER)
.create_pacticipant(CONSUMER, main_branch: "main")
.publish_contract(consumer: CONSUMER, consumer_version: "2", provider: PROVIDER, content_id: "111", branch: "feature/fun-123")
.get_pacts_for_verification(
provider: PROVIDER,
enable_pending: true,
provider_version_branch: "feature/fun-123",
include_wip_pacts_since: "2020-01-01",
consumer_version_selectors: [{ mainBranch: true } , { deployedOrReleased: true }]
)
.verify_pact(
index: 0,
provider_version_branch: "feature/fun-123",
provider_version: "2",
success: true
)
.can_i_deploy(pacticipant: PROVIDER, version: "2", to_environment: "test")
.get_pacts_for_verification(
provider: PROVIDER,
enable_pending: true,
provider_version_branch: "main",
include_wip_pacts_since: "2020-01-01",
consumer_version_selectors: [{ mainBranch: true }, { deployedOrReleased: true }]
)
rescue StandardError => e
puts "#{e.class} #{e.message}"
puts e.backtrace
exit 1
end
Beth (pactflow.io/Pact Broker/pact-ruby)
Hazem Borham
03/30/2023, 12:52 AMHazem Borham
03/30/2023, 12:53 AMBeth (pactflow.io/Pact Broker/pact-ruby)
Hazem Borham
03/30/2023, 12:54 AMHazem Borham
03/30/2023, 12:55 AMHazem Borham
03/30/2023, 12:56 AMHazem Borham
03/30/2023, 12:57 AMBeth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Hazem Borham
03/30/2023, 12:59 AMBeth (pactflow.io/Pact Broker/pact-ruby)
Hazem Borham
03/30/2023, 1:01 AMBeth (pactflow.io/Pact Broker/pact-ruby)
Hazem Borham
03/30/2023, 1:01 AMMatt (pactflow.io / pact-js / pact-go)
Hazem Borham
03/30/2023, 5:01 PM