pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 479 forks source link

Discrepancy in tags separator between PactBroker and pact-jvm provider tests. #1262

Open wwluk opened 3 years ago

wwluk commented 3 years ago

PactBroker can send list of consumer tags ${pactbroker.consumerVersionTags} in a webhook call to trigger provider tests. As described in docs it's a list of tags separated with comma and space (,). Unfortunately, on the pact-jvm provider tests side ExpressionParser.kt splits the property pactbroker.consumerversionselectors.tags by comma only - javadocs.

The resulting list of tags has the first tag correct, but the latter ones have a space prepended. For example tags dev, prod sent from pact broker is split into dev and prod. Later then, pact provider tests try to query PactBroker for space prepended _prod tag, which does not exist in PactBroker.

To work around that, I am replacing , with , before passing string of tags to pact-jvm provider test.

I think changing ExpressionParser.kt to split by something like ,\s? would fix the problem.

uglyog commented 3 years ago

4.1.12 released with this fix