2017-02-23 5 views
1

私はpact java> Pact verifyを使用しています。プロバイダホストがlocalhostの場合、Pact verifyが機能します。 他のホストの詳細情報を提供するにはどうすればよいですか?私は、Pact >> localhost以外のPactプロバイダホスト


<serviceProvider> 
    <name>provider1</name> 
    <protocol>http</protocol> 
    **<host>**google.com**</host>** 
    <path>/</path> 

    <consumers> 
    <consumer> 
    <name>consumer1</name> 
    <pactFile>../pacts/test_consumer-test_provider.json</pactFile> 
    </consumer> 
    </consumers> 
</serviceProvider> 

をこのようなプロバイダを指定 私はいくつかの他のホストの詳細を提供するにはどうすればよい


Verifying a pact between consumer1 and provider1 
    [Using file ../pacts/test_consumer-test_provider.json] 
    Given test state 
     WARNING: State Change ignored as there is no stateChange URL 
    Invalid Information Model 
     Request Failed - google.com 

応答を受信?

答えて

2

google.comは有効なホストではないため、Googleの基本ドメイン名です。リクエストを送信するための実際のホスト名を指定する必要があります。例えば

google.comにカール使用:

$ curl -v http://google.com 
* Rebuilt URL to: http://google.com/ 
* Trying 216.58.203.110... 
* Connected to google.com (216.58.203.110) port 80 (#0) 
> GET/HTTP/1.1 
> Host: google.com 
> User-Agent: curl/7.47.0 
> Accept: */* 
> 
< HTTP/1.1 302 Found 
< Cache-Control: private 
< Content-Type: text/html; charset=UTF-8 
< Referrer-Policy: no-referrer 
< Location: http://www.google.com.au/?gfe_rd=cr&ei=ckz9WMKPDYTr8weL36iABA 
< Content-Length: 262 
< Date: Mon, 24 Apr 2017 00:53:06 GMT 
< 
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> 
<TITLE>302 Moved</TITLE></HEAD><BODY> 
<H1>302 Moved</H1> 
The document has moved 
<A HREF="http://www.google.com.au/?gfe_rd=cr&amp;ei=ckz9WMKPDYTr8weL36iABA">here</A>. 
</BODY></HTML> 

302 Moved応答を返します。

デバッグログを有効にして(Mavenの-Xパラメータ)実行すると、検証者が要求を失敗として処理した理由を詳細に知る必要があります。

0

ホストはプロバイダのIPアドレスまたはホスト名です。だから、あなたのプロバイダが展開されたどこかで言うことができたら、その展開のIPアドレスを提供する必要があります。あなたは単にgoogle.comとしてホスト名をランダムに提供することはできません。

関連する問題