1

最初通过从 github 位置下载项目开始分析 PACT。在现有项目中,我已经包含了我的 GET 请求 services.groupkt.com/country/get/iso2code/IN 的代码。

我能够生成 PACT 文件,但是当我尝试从生产者端验证时,我收到以下消息

 D:\microservices-pact-maven-master\microservices-pact-consumer>mvn    au.com.dius:p
act-jvm-provider-maven_2.11:verify
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building microservices-pact-consumer 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- pact-jvm-provider-maven_2.11:3.2.2:verify (default-cli) @ microservic
es-pact-consumer ---
Loading pact files for provider Foo_Provider from D:\microservices-pact-maven-ma
ster\microservices-pact-consumer\target\pacts
Skipping D:\microservices-pact-maven-master\microservices-pact-consumer\target\p
**acts\Country_Consumer-Country_Provider.json as the provider names don't match pr
ovider.name: Foo_Provider vs pactJson.provider.name: Country_Provider
Found 1 pact files**

Verifying a pact between Foo_Consumer and Foo_Provider
  [Using file D:\microservices-pact-maven-master\microservices-pact-consumer\tar
get\pacts\Foo_Consumer-Foo_Provider.json]
  a request for Foos
    returns a response which
      has status code 200 (OK)
      includes headers

有人可以帮我解决这个问题。

提前致谢

苏什玛

4

1 回答 1

1

这可能是创建 PACT 的消费者测试中提到的提供者名称的问题。我认为您的代码在您的消费者协议类中具有以下值。

@Pact(provider = "Foo_provider", 消费者 = "Foo_consumer")

请根据您的要求更改提供者和消费者名称。再次运行消费者测试,然后运行提供者测试。

于 2017-08-28T09:25:35.710 回答