Skip to content

Commit

Permalink
Merge branch 'master' into v4.6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Jun 23, 2023
2 parents 9f5aa17 + 16748fe commit 1c893cf
Show file tree
Hide file tree
Showing 39 changed files with 2,515 additions and 92 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/compatability-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Pact-JVM Compatibility Suite

on:
push:
branches: [ master, v4.1.x, v4.4.x, v4.5.x ]
pull_request:
branches: [ master, v4.1.x, v4.4.x, v4.5.x ]

jobs:
v1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 18
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 18
- name: Build with Gradle
run: ./gradlew --no-daemon :compatibility-suite:v1
- name: Archive cucumber results
uses: actions/upload-artifact@v3
with:
name: cucumber-report
path: compatibility-suite/build/cucumber-report-v1.html
if: always()
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
To generate the log, run `git log --pretty='* %h - %s (%an, %ad)' TAGNAME..HEAD` replacing TAGNAME and HEAD as appropriate.

# 4.5.7 - Bugfix Release

* abf5fb86b - fix: EachValue matcher was applying the associated rule to the list and not the items in the list (Ronald Holshausen, Thu Jun 22 15:29:09 2023 +1000)
* d376e7e69 - chore: fix codenarc and detect voilations (Ronald Holshausen, Wed Jun 21 17:02:13 2023 +1000)
* a2f7fbfb3 - fix: Support string escape sequences in matching definitions (Ronald Holshausen, Wed Jun 21 16:53:26 2023 +1000)
* 3c78dc53b - chore: correct the no provider state callback configured + request filters steps (Ronald Holshausen, Thu Jun 15 16:14:52 2023 +1000)
* 0cd9ad025 - feat: Implemented scenarios for no provider state callback configured + request filters (Ronald Holshausen, Thu Jun 15 16:04:50 2023 +1000)
* d8c196e01 - Update compatibility suite to commit 'a7a339bb861188580422c6b8b76be86d304770c1' (Ronald Holshausen, Thu Jun 15 16:03:48 2023 +1000)
* a7a339bb8 - Squashed 'compatibility-suite/pact-compatibility-suite/' changes from 89749010a..aa10f0521 (Ronald Holshausen, Thu Jun 15 16:03:48 2023 +1000)
* fdea11eae - feat: Add builder interface for plugins to provide DSL to construct interactions (Ronald Holshausen, Wed Jun 7 14:54:26 2023 +1000)
* 7c41fc104 - feat: implement compatibility suite provider state steps (Ronald Holshausen, Wed May 31 10:13:57 2023 +1000)
* 0f5dc4184 - feat: Call provider state callbacks with empty state when there is no state defined (Ronald Holshausen, Wed May 31 10:13:15 2023 +1000)
* 45df56972 - Squashed 'compatibility-suite/pact-compatibility-suite/' changes from 4ced3ca47..89749010a (Ronald Holshausen, Wed May 31 10:11:46 2023 +1000)
* 584734e3a - Update compatability suite to commit '45df569728f419c1a8df175f2fd560d105948864' (Ronald Holshausen, Wed May 31 10:11:46 2023 +1000)
* f3932f5ff - chore: revert change that broke automatic module naming (Ronald Holshausen, Tue May 30 14:33:03 2023 +1000)
* 917d286ef - Merge pull request #1694 from Danny02/feature/fix-automatic-module-name (Ronald Holshausen, Tue May 30 14:31:40 2023 +1000)
* 18265d7ff - fix: correct the compatibility suite steps after latest update (Ronald Holshausen, Tue May 30 14:28:15 2023 +1000)
* b699ccde5 - Squashed 'compatibility-suite/pact-compatibility-suite/' changes from 722ff956f..4ced3ca47 (Ronald Holshausen, Tue May 30 12:58:20 2023 +1000)
* 938eb6335 - Update compatability suite to commit 'b699ccde5337737bf06b29d97e2705ab7c9468cc' (Ronald Holshausen, Tue May 30 12:58:20 2023 +1000)
* 7e8d7fc78 - fix: MockServerURLGenerator was not combining URL fragments correctly (Ronald Holshausen, Tue May 30 12:57:20 2023 +1000)
* b369fecf7 - feat: got the remaining V1 HTTP provider scenarios passing (Ronald Holshausen, Thu May 25 15:48:58 2023 +1000)
* e43d28319 - Squashed 'compatibility-suite/pact-compatibility-suite/' changes from 70e1b0a4f..722ff956f (Ronald Holshausen, Thu May 25 15:48:03 2023 +1000)
* a216424d9 - Update compatability suite to commit 'e43d28319147529997a567b45777495ff66241c4' (Ronald Holshausen, Thu May 25 15:48:03 2023 +1000)
* b7b2a12f9 - feat: Implemented initial V1 HTTP provider specs in compatibility suite (Ronald Holshausen, Thu May 25 14:53:14 2023 +1000)
* c83dd5d29 - Squashed 'compatibility-suite/pact-compatibility-suite/' changes from b3323750e..70e1b0a4f (Ronald Holshausen, Thu May 25 14:48:46 2023 +1000)
* 3db9bce9f - Merge compatibility suite commit 'c83dd5d2971131c897cfab511a8c502d0b506961' (Ronald Holshausen, Thu May 25 14:48:46 2023 +1000)
* a0a5a9648 - use valid module name in manifest (Daniel Heinrich, Mon May 22 14:01:31 2023 +0200)
* b250377e3 - Squashed 'compatibility-suite/pact-compatibility-suite/' changes from 7c4fb6b9f..b3323750e (Ronald Holshausen, Thu May 18 15:06:00 2023 +1000)
* 856321152 - Update compatability suite to commit 'b250377e3caf5862ac44a9d96287dd100180e7b0' (Ronald Holshausen, Thu May 18 15:06:00 2023 +1000)
* dbc59a4dc - feat: Implement the remaining V1 HTTP consumer scenarios (Ronald Holshausen, Wed May 17 16:04:33 2023 +1000)
* d3dad3d29 - Squashed 'compatibility-suite/pact-compatibility-suite/' changes from 203d64c52..7c4fb6b9f (Ronald Holshausen, Wed May 17 16:02:22 2023 +1000)
* f05fd81e4 - Update compatability suite to commit 'd3dad3d2998414b3add7a277d3c1de0b686e890c' (Ronald Holshausen, Wed May 17 16:02:22 2023 +1000)
* e4eab7be4 - feat: Implement initial compatibility suite feature for V1/HTTP interactions (Ronald Holshausen, Tue May 16 13:09:13 2023 +1000)
* 8baa3bde5 - Squashed 'compatibility-suite/pact-compatibility-suite/' changes from 7938b5832..203d64c52 (Ronald Holshausen, Tue May 16 13:06:53 2023 +1000)
* 70a6c7cac - Update compatibility suite to commit '8baa3bde503bbab887d8618da456e7e3fdfa879c' (Ronald Holshausen, Tue May 16 13:06:53 2023 +1000)
* 2cdb862c7 - chore: fix compatability-suite build (Ronald Holshausen, Mon May 15 15:25:59 2023 +1000)
* b8682e966 - chore: attach report for compatibility-suite build (Ronald Holshausen, Mon May 15 15:15:48 2023 +1000)
* b5092bba9 - feat: Add compatibility-suite to CI build (Ronald Holshausen, Mon May 15 14:54:36 2023 +1000)
* 4ab3cda81 - Squashed 'compatibility-suite/pact-compatibility-suite/' changes from b5ba1cc60..7938b5832 (Ronald Holshausen, Mon May 15 14:29:20 2023 +1000)
* e39ce0b9d - Merge pact-compatibility-suite (Ronald Holshausen, Mon May 15 14:29:20 2023 +1000)
* f0cbcf56e - Merge pull request #1691 from holomekc/feature/port-expression (Ronald Holshausen, Mon May 15 12:38:41 2023 +1000)
* fa65ca2b5 - Allow to set the port via an expression. (holomekc, Fri May 12 13:49:55 2023 +0200)
* 2a8b60212 - Update README.md (Ronald Holshausen, Mon May 8 10:14:21 2023 +1000)
* 1819fcf0b - chore: add or and orElse to Result class (Ronald Holshausen, Fri May 5 15:25:31 2023 +1000)
* 276bf561a - Squashed 'compatibility-suite/pact-compatibility-suite/' content from commit b5ba1cc60 (Ronald Holshausen, Mon May 1 15:23:04 2023 +1000)
* 6f072fb25 - Merge commit '276bf561a9a87cf2ed734cc30c31f2b495be8d4e' as 'compatibility-suite/pact-compatibility-suite' (Ronald Holshausen, Mon May 1 15:23:04 2023 +1000)
* 8da0855fa - Merge pull request #1685 from holly-cummins/shorthand-annotation (Ronald Holshausen, Mon May 1 15:07:34 2023 +1000)
* d3dbc522c - Use shorthand annotation instead of @ExtendWith (Holly Cummins, Wed Apr 19 15:01:00 2023 +0100)
* a7c2314f7 - bump version to 4.5.7 (Ronald Holshausen, Wed Apr 12 15:50:47 2023 +1000)

# 4.6.0 - Kotlin 1.8 + JDK 17 release

* f5aff8277 - chore: Upgrade dependencies (Ronald Holshausen, Fri May 5 16:56:45 2023 +1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jar {
'Specification-Vendor': project.group,
'Specification-Title': project.name,
'Specification-Version': archiveVersion,
'Automatic-Module-Name': project.group + "." + project.name.replaceAll('-', '_')
'Automatic-Module-Name': (project.group + "." + project.name).replaceAll('-', '_')
}
}

Expand Down
47 changes: 47 additions & 0 deletions compatibility-suite/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
id 'au.com.dius.pact.kotlin-common-conventions'
}

configurations {
cucumberRuntime {
extendsFrom testImplementation
}
}

dependencies {
testImplementation 'io.cucumber:cucumber-java:7.12.0'
testImplementation 'io.cucumber:cucumber-picocontainer:7.12.0'
testImplementation 'org.apache.groovy:groovy'
testImplementation 'org.apache.groovy:groovy-json'
testImplementation project(':core:model')
testImplementation project(':core:matchers')
testImplementation project(':consumer')
testImplementation project(':provider')
testImplementation('io.pact.plugin.driver:core') {
exclude group: 'au.com.dius.pact.core'
}
testImplementation 'ch.qos.logback:logback-classic'
implementation 'io.ktor:ktor-http-jvm'
}

tasks.register('v1') {
dependsOn assemble, testClasses
doLast {
def cucumberArgs = [
'--plugin', 'pretty',
'--plugin', 'html:build/cucumber-report-v1.html',
'--glue', 'steps.v1',
'pact-compatibility-suite/features/V1'
]
if (project.hasProperty('cucumber.filter.tags')) {
cucumberArgs.add(0, project.property('cucumber.filter.tags'))
cucumberArgs.add(0, '-t')
}
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = cucumberArgs
systemProperty 'pact_do_not_track', 'true'
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
@consumer
Feature: Basic HTTP consumer
Supports basic HTTP consumer interactions

Background:
Given the following HTTP interactions have been defined:
| method | path | query | headers | body | response | response content | response body |
| GET | /basic | | | | 200 | application/json | basic.json |
| GET | /with_params | a=1&b=2 | | | 200 | | |
| GET | /with_headers | | 'X-TEST: Compatibility' | | 200 | | |
| PUT | /basic | | | basic.json | 200 | | |

Scenario: When all requests are made to the mock server
When the mock server is started with interaction {1}
And request {1} is made to the mock server
Then a 200 success response is returned
And the payload will contain the "basic" JSON document
And the content type will be set as "application/json"
When the pact test is done
Then the mock server status will be OK
And the mock server will write out a Pact file for the interaction when done
And the pact file will contain {1} interaction
And the {first} interaction request will be for a "GET"
And the {first} interaction response will contain the "basic.json" document

Scenario: When not all requests are made to the mock server
When the mock server is started with interactions "1, 2"
And request {1} is made to the mock server
Then a 200 success response is returned
When the pact test is done
Then the mock server status will NOT be OK
And the mock server will NOT write out a Pact file for the interactions when done
And the mock server status will be an expected but not received error for interaction {2}

Scenario: When an unexpected request is made to the mock server
When the mock server is started with interaction {1}
And request {2} is made to the mock server
Then a 500 error response is returned
When the pact test is done
Then the mock server status will NOT be OK
And the mock server will NOT write out a Pact file for the interactions when done
And the mock server status will be an unexpected "GET" request received error for interaction {2}

Scenario: Request with query parameters
When the mock server is started with interaction {2}
And request {2} is made to the mock server
Then a 200 success response is returned
When the pact test is done
Then the mock server status will be OK
And the mock server will write out a Pact file for the interaction when done
And the pact file will contain {1} interaction
And the {first} interaction request query parameters will be "a=1&b=2"

Scenario: Request with invalid query parameters
When the mock server is started with interaction {2}
And request {2} is made to the mock server with the following changes:
| query |
| a=1&c=3 |
Then a 500 error response is returned
When the pact test is done
Then the mock server status will NOT be OK
And the mock server status will be mismatches
And the mismatches will contain a "query" mismatch with error "Expected query parameter 'b' but was missing"
And the mismatches will contain a "query" mismatch with error "Unexpected query parameter 'c' received"
And the mock server will NOT write out a Pact file for the interaction when done

Scenario: Request with invalid path
When the mock server is started with interaction {1}
And request {1} is made to the mock server with the following changes:
| path |
| /path |
Then a 500 error response is returned
When the pact test is done
Then the mock server status will NOT be OK
And the mock server will NOT write out a Pact file for the interaction when done
And the mock server status will be an unexpected "GET" request received error for path "/path"

Scenario: Request with invalid method
When the mock server is started with interaction {1}
And request {1} is made to the mock server with the following changes:
| method |
| HEAD |
Then a 500 error response is returned
When the pact test is done
Then the mock server status will NOT be OK
And the mock server will NOT write out a Pact file for the interaction when done
And the mock server status will be an unexpected "HEAD" request received error for path "/basic"

Scenario: Request with headers
When the mock server is started with interaction {3}
And request {3} is made to the mock server
Then a 200 success response is returned
When the pact test is done
Then the mock server status will be OK
And the mock server will write out a Pact file for the interaction when done
And the pact file will contain {1} interaction
And the {first} interaction request will contain the header "X-TEST" with value "Compatibility"

Scenario: Request with invalid headers
When the mock server is started with interaction {3}
And request {3} is made to the mock server with the following changes:
| headers |
| 'X-OTHER: Something' |
Then a 500 error response is returned
When the pact test is done
Then the mock server status will NOT be OK
And the mock server status will be mismatches
And the mismatches will contain a "header" mismatch with error "Expected a header 'X-TEST' but was missing"
And the mock server will NOT write out a Pact file for the interaction when done

Scenario: Request with body
When the mock server is started with interaction {4}
And request {4} is made to the mock server
Then a 200 success response is returned
When the pact test is done
Then the mock server status will be OK
And the mock server will write out a Pact file for the interaction when done
And the pact file will contain {1} interaction
And the {first} interaction request will be for a "PUT"
And the {first} interaction request content type will be "application/json"
And the {first} interaction request will contain the "basic.json" document

Scenario: Request with invalid body
When the mock server is started with interaction {4}
And request {4} is made to the mock server with the following changes:
| body |
| JSON: {"one": "a", "two": "c"} |
Then a 500 error response is returned
When the pact test is done
Then the mock server status will NOT be OK
And the mock server status will be mismatches
And the mismatches will contain a "body" mismatch with path "$.two" with error "Expected 'b' (String) but received 'c' (String)"
And the mock server will NOT write out a Pact file for the interaction when done

Scenario: Request with the incorrect type of body contents
When the mock server is started with interaction {4}
And request {4} is made to the mock server with the following changes:
| body |
| XML: <?xml version="1.0" encoding="UTF-8"?><alligator name="Mary" feet="4"/> |
Then a 500 error response is returned
When the pact test is done
Then the mock server status will NOT be OK
And the mock server status will be mismatches
And the mismatches will contain a "body-content-type" mismatch with error "Expected a body of 'application/json' but the actual content type was 'application/xml'"
And the mock server will NOT write out a Pact file for the interaction when done
Loading

0 comments on commit 1c893cf

Please sign in to comment.