[PactNet 4.0.0-beta.1] PublishResults options raising an exception
See original GitHub issueA very basic example like this throws an exception with when publishing results
[Fact]
public void VerifyLatestPacts()
{
string version = Environment.GetEnvironmentVariable("VERSION");
string branch = Environment.GetEnvironmentVariable("BRANCH");
string buildUri = Environment.GetEnvironmentVariable("BUILD_URL");
var config = new PactVerifierConfig
{
LogLevel = PactLogLevel.Information,
Outputters = new List<IOutput>
{
new XUnitOutput(this.output)
}
};
IPactVerifier verifier = new PactVerifier(config);
verifier.ServiceProvider("My Provider", this.fixture.ServerUri)
.WithPactBrokerSource(new Uri("https://broker.example.org"), options =>
{
options.ConsumerVersionSelectors(new ConsumerVersionSelector { MainBranch = true, Latest = true })
.PublishResults(version, results =>
{
results.ProviderBranch(branch)
.BuildUri(new Uri(buildUri));
});
})
.WithProviderStateUrl(new Uri(this.fixture.ServerUri, "/provider-states"))
.Verify();
}
}
Error
Failed API.Tests.ProductApiContractVerificationTests.EnsureProductApiHonorsPactWithOrderServiceConsumer [118 ms]
Error Message:
System.ArgumentNullException : Value cannot be null. (Parameter 'source')
Stack Trace:
at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at PactNet.Verifier.InteropVerifierProvider.SetPublishOptions(String providerVersion, Uri buildUrl, ICollection`1 providerTags, String providerBranch)
at PactNet.Verifier.PactBrokerPublishOptions.Apply()
at PactNet.Verifier.PactBrokerOptions.PublishResults(String providerVersion, Action`1 configure)
at API.Tests.ProductApiContractVerificationTests.<EnsureProductApiHonorsPactWithOrderServiceConsumer>b__1_0(IPactBrokerOptions options) in C:\pact-workshop\pact_ffi-product-provider\tests\ProductApiContractVerificationTests.cs:line 70
at PactNet.Verifier.PactVerifierProvider.WithPactBrokerSource(Uri brokerBaseUri, Action`1 configure)
at API.Tests.ProductApiContractVerificationTests.EnsureProductApiHonorsPactWithOrderServiceConsumer() in C:\pact-workshop\pact_ffi-product-provider\tests\ProductApiContractVerificationTests.cs:line 67
Test Run Failed.
adding the .ProviderTags("stage");
option seems mandatory
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Allow Pact Verifier with Pact Broker Source to publish ...
Hi. I am currently migrating a codebase to PactNet v4 Beta versions and would like to publish the Verification results to a pact...
Read more >Pact Maven plugin | Pact Docs
This is a Maven plugin for verifying pacts against a running provider, publishing pacts generated by consumer tests,
Read more >has joined #protobufs - Pact (Contract Testing)
I was thinking that it would be possible to add an intermediate layer between the language-specific client and the (currently Ruby) mock server...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, that’s gonna be missing an Array.Empty when something is calling into the interop code.
We definitely need better coverage using a real pact broker in integration tests. One thing that makes that a bit tricky is that different broker versions support different options, and it’s not really clear what the support policy of the broker is.
This is so annoying! I wish they’d only close it when the commit was tagged in a release.