Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use concise Pact Source descriptions #1015

Merged
merged 2 commits into from
Feb 17, 2020

Conversation

asteffey
Copy link
Contributor

@asteffey asteffey commented Feb 4, 2020

Problem to solve

Pact provider tests print out overly verbose Pact source descriptions (i.e. use default Kotlin toString) when using a Directory or Pact Broker source.

Steps to reproduce

Seen when running provider tests using Pacts from a directory or Pact-Broker with pact-jvm-provider-junit5 plugin.

Current behavior

Verifying a pact between JsonConsumer and JsonProvider
  [Using DirectorySource(dir=target\pacts, pacts={target\pacts\JsonConsumer-JsonProvider.json=MessagePact(provider=Provider(name=JsonProvider), consumer=Consumer(name=JsonConsumer), messages=[Message(description='json array with extra values', providerStates=[ProviderState(name=some state, params={})], contents=PRESENT({"JsonArray":[{"key":"required"},{"key":"something else"}]}), matchingRules=MatchingRules(rules={body=Category(name=body, matchingRules={$.JsonArray=MatchingRuleGroup(rules=[MinTypeMatcher(min=1)], ruleLogic=AND), $.JsonArray[*].key=MatchingRuleGroup(rules=[au.com.dius.pact.core.model.matchingrules.TypeMatcher@6c0d7c83], ruleLogic=AND)})}), generators=Generators(categories={}), metaData={contentType=application/json; charset=UTF-8}), Message(description='json object with extra values', providerStates=[ProviderState(name=some state, params={})], contents=PRESENT({"JsonObject":{"key":"required"}}), matchingRules=MatchingRules(rules={body=Category(name=body, matchingRules={$.JsonObject.key=MatchingRuleGroup(rules=[au.com.dius.pact.core.model.matchingrules.TypeMatcher@6c0d7c83], ruleLogic=AND)})}), generators=Generators(categories={}), metaData={contentType=application/json; charset=UTF-8})], metadata={pactSpecification={version=3.0.0}, pact-jvm={version=4.0.1}})})]
  Given some state
  json array with extra values
    generates a message which
      has a matching body (OK)
      has matching metadata (OK)

Expected behavior

Verifying a pact between JsonConsumer and JsonProvider
  [Using Directory target\pacts]
  Given some state
  json array with extra values
    generates a message which
      has a matching body (OK)
      has matching metadata (OK)

Proposed Fix

Implement description methods for DirectorySource and PactBrokerSource,
instead of having them fallback to default Kotlin toString.

Have PactBrokerLoader resolve system parameters, so PactBrokerSource
shows a valid url instead of ${...} placeholders.

NOTICE

This software was produced for the U. S. Government under Contract No. FA8702-20-C-0001, and is subject to the Rights in Noncommercial Computer Software and Noncommercial Computer Software Documentation Clause DFARS 252.227-7014 (FEB 2014)

Approved for Public Release; Distribution Unlimited. Case Number 19-3203.

(c) 2020 The MITRE Corporation. All Rights Reserved.

uglyog
uglyog previously approved these changes Feb 8, 2020

Verified

This commit was signed with the committer’s verified signature. The key has expired.
vbgl Vincent Laporte
Implement description methods for DirectorySource and PactBrokerSource,
instead of having them fallback to default Kotlin toString.

Have PactBrokerLoader resolve system parameters, so PactBrokerSource
shows a valid url instead of ${...} placeholders.
@asteffey
Copy link
Contributor Author

in the latest revision, I applied the same changes to the new kotlin version of PactBrokerLoader instead.

@uglyog uglyog merged commit 01396e6 into pact-foundation:master Feb 17, 2020
@uglyog
Copy link
Member

uglyog commented Feb 22, 2020

4.0.6 has been released with this fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants