Marcin Baranowski
09/23/2021, 10:53 AMInvalid pact broker host specified ('${pactbroker.host:}'). Please provide a valid host or specify the system property 'pactbroker.host'.
java.lang.IllegalArgumentException: Invalid pact broker host specified ('${pactbroker.host:}'). Please provide a valid host or specify the system property 'pactbroker.host'.
My application.yaml has:
pactbroker:
host: "<https://valid-host>"
port: 443
protocol: "https"
auth:
token: "tokenValue"
I use gradle and my only pact dep is:
testImplementation("au.com.dius.pact.provider:junit5spring:4.2.11")
My Test:
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Provider("provider")
@PactBroker
public class PactTest extends AbstractIntegrationTest {
@LocalServerPort int port;
@Value("${pactbroker.host}")
String host;
@BeforeEach
public void setupTestTarget(PactVerificationContext context) {
System.out.println("host");
System.out.println(host);
context.setTarget(new HttpTestTarget("localhost", port));
}
@TestTemplate
@ExtendWith(PactVerificationSpringProvider.class)
public void pactVerificationTestTemplate(PactVerificationContext context) {
context.verifyInteraction();
}
}
Host value is assigned correctly in test file.
Why Pact doesn't see these values? What should I change?JapuDCret
09/23/2021, 11:01 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Marcin Baranowski
09/23/2021, 11:46 AMMatt (pactflow.io / pact-js / pact-go)
Marcin Baranowski
09/23/2021, 12:03 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Marcin Baranowski
09/27/2021, 8:23 AMJason Army
07/25/2022, 6:05 PM@PactBroker
annotation. e.g.
@PactBroker(
url = "${pactbroker.url}",
consumerVersionSelectors = {
@VersionSelector(tag = "master"),
@VersionSelector(tag = "prod"),
@VersionSelector(tag = "dr")
})