ITV / scala-pact

A Scala implementation of CDC using the Pact standard
Other
108 stars 54 forks source link

Wip pacts #200

Closed jbwheatley closed 3 years ago

jbwheatley commented 3 years ago

https://github.com/ITV/scala-pact/issues/161

Adds a CLI setting --includeWipPactsSince that is passed to the pact broker when verifying pacts from the provider, which (as the name suggests) fetched pacts that the broker determined are "WIP". See the original issue for more details https://github.com/pact-foundation/pact_broker/issues/338. This accepts dates in the following formats: 2020-10-23, 2020-10-23T22:00 and 2020-10-23T22:00+01:00 i.e. java LocalDate, LocalDateTime and OffsetDateTime. Default values for the hour/minute are 00:00, and the default timezone is UTC.

In the verification test suite, the field includePendingStatus is replaced with a field pendingPactSettings, which encompasses settings for fetching pending pacts, and the finer-grained WIP pacts. PendingPactSettings is an ADT with 3 possible values: PendingDisabled, PendingEnabled, and IncludeWipPacts(wipPactsSince: OffsetDateTime).

As the date for WIP pacts to be fetched from is in most cases going to be dynamic based on the current date, I have not included an sbt setting key for it, as I would recommend it being set using the CLI arguments. If there is demand, we can add it there too though.

jbwheatley commented 3 years ago

@dantb you're right, making it an ADT solves a lot of problems. Good stuff.