quarkiverse / quarkus-pact

Pact is a widely-recommended framework for consumer-driven contract testing. This Quarkus extension gives the best Pact integration with Quarkus.
https://pact.io/
Apache License 2.0
13 stars 6 forks source link

Quarkus-style configuration of pact location and broker #9

Open holly-cummins opened 2 years ago

holly-cummins commented 2 years ago

We should make sure things set in application.properties are made available to the tests.

This is related to https://github.com/quarkiverse/quarkus-pact/issues/3, but different enough that it should get its own issue. The other issue is about enabling dynamic behaviour in the annotation, this is about more general quarkus-friendly config, as we do for many other extensions.

holly-cummins commented 2 years ago

This should be quite straightforward and perhaps even a no-op (apart from testing), since the broker config can be set by setting the pactbroker.* system properties

  /**
   * @return URL of pact broker
   */
  String url() default "${pactbroker.url:}";
holly-cummins commented 1 year ago

I retract my earlier optimism. The Pact classes read directly from the system properties, which means they wouldn't see anything set in application.properties. We may need changes to Pact itself to allow injection of config, or we would need to instrument the annotations to inject our config.

We'd also need to think about precedence if config is set with a system property and in application properties (which Quarkus config may automatically sort out for us), and if it's set in an annotation and in application properties (which Quarkus config would not help with).