警告:使用 pact-python 验证协议时忽略不支持的匹配规则
WARN: Ignoring unsupported matching rules while verifying pact using pact-python
我是 Pact 的新手,我正在尝试使用 pact-python 在提供商端验证一个协议,但一些匹配规则被忽略了。
警告:忽略不支持的匹配规则 {"$.num_issues"=>{"matchers"=>[{"match"=>"integer"}], "combine"=>"AND" }, "$.error"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.response[0].issue_id"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.response[0].msg"=>{"matchers"= >[{"match"=>"type"}], "combine"=>"AND"}, "$.response[0].similar_fix_found"=>{"matchers"=>[{"match "=>"type"}], "combine"=>"AND"}, "$.response[1].issue_id"=>{"matchers"=>[{"match"=>"type "}], "combine"=>"AND"}, "$.response[1].msg"=>{"matchers"=>[{"match"=>"type"}], "combine"=> "AND"}, "$.response[1].similar_fix_found"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}}对于路径 ['body']
消费者基于 Java API,提供者基于 Python API。
"body": {
"$.num_issues": {
"matchers": [
{
"match": "integer"
}
],
"combine": "AND"
},
"$.error": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[0].issue_id": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[0].msg": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[0].similar_fix_found": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[1].issue_id": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[1].msg": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[1].similar_fix_found": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
}
}
}
}
}
],
"metadata": {
"pact-specification": {
"version": "3.0.0"
}
}
手动将 pact-specification 版本更改为 2.0.0 也没有按要求工作。
任何人都可以提出建议吗..?
您需要在 Java 消费者测试中明确设置规范版本。
例如,在 JUnit 测试中,您可以这样做:
@PactTestFor(providerName = "pactflow-example-provider-java-kafka", providerType = ProviderType.ASYNCH, pactVersion = PactSpecVersion.V2)
pact文件的匹配器和结构因版本而异,因此仅在之后更改pact中的版本无济于事。
我是 Pact 的新手,我正在尝试使用 pact-python 在提供商端验证一个协议,但一些匹配规则被忽略了。
警告:忽略不支持的匹配规则 {"$.num_issues"=>{"matchers"=>[{"match"=>"integer"}], "combine"=>"AND" }, "$.error"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.response[0].issue_id"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.response[0].msg"=>{"matchers"= >[{"match"=>"type"}], "combine"=>"AND"}, "$.response[0].similar_fix_found"=>{"matchers"=>[{"match "=>"type"}], "combine"=>"AND"}, "$.response[1].issue_id"=>{"matchers"=>[{"match"=>"type "}], "combine"=>"AND"}, "$.response[1].msg"=>{"matchers"=>[{"match"=>"type"}], "combine"=> "AND"}, "$.response[1].similar_fix_found"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}}对于路径 ['body']
消费者基于 Java API,提供者基于 Python API。
"body": {
"$.num_issues": {
"matchers": [
{
"match": "integer"
}
],
"combine": "AND"
},
"$.error": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[0].issue_id": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[0].msg": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[0].similar_fix_found": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[1].issue_id": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[1].msg": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[1].similar_fix_found": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
}
}
}
}
}
],
"metadata": {
"pact-specification": {
"version": "3.0.0"
}
}
手动将 pact-specification 版本更改为 2.0.0 也没有按要求工作。
任何人都可以提出建议吗..?
您需要在 Java 消费者测试中明确设置规范版本。
例如,在 JUnit 测试中,您可以这样做:
@PactTestFor(providerName = "pactflow-example-provider-java-kafka", providerType = ProviderType.ASYNCH, pactVersion = PactSpecVersion.V2)
pact文件的匹配器和结构因版本而异,因此仅在之后更改pact中的版本无济于事。