- 操作系统:Mac OSX 10.15.7_
- 契约:9.15.5
- 契约节点版本:10.12.2
- 节点版本:12.13.0
我确定我做错了什么,但我不知道如何让它工作。
我有 2 个客户 (ClientA
和ClientB
) 与 provider 有合同(每个都标记为“master”)发布到协议代理(版本 2.79.1)DemoService
。
契约经纪人矩阵(简化):
消费者 | 版本 | 标签 | 提供者 | 版本 | 已验证 | |
---|---|---|---|---|---|---|
客户A | 1.0.1-2726fe4 | 掌握 | - | 演示服务 | 1.0.0-a6b2678 | |
客户A | 1.0.0-12ab763 | 掌握 | - | 演示服务 | 1.0.0-a6b2678 | |
客户B | 1.0.1-6fe3cb5 | 掌握 | - | 演示服务 | 1.0.0-a6b2678 | |
客户B | 1.0.0-ec71b62 | 掌握 | - | 演示服务 | 1.0.0-a6b2678 |
我尝试设置一个来验证与提供商ConsumerVersionSelector
签订的合同的特定版本。ClientA
import { Verifier} from "@pact-foundation/pact";
import { ConsumerVersionSelector } from "@pact-foundation/pact-node/src/verifier";
describe("PACT Verification", () => {
test(`Validates the expectations of Provider: DemoService`, () => {
return new Verifier({
providerBaseUrl: `http://${config.app_server_host}:${config.app_port}/`,
pactBrokerUrl: 'https://local/pactbroker/',
provider: 'DemoService',
providerVersion: '1.0.0-a6b2678',
providerVersionTags: 'master',
logLevel: 'debug',
logDir: 'log',
consumerVersionSelectors: [{
all: false,
latest: false,
tag: 'master',
version: '1.0.0-2726fe4',
pacticipant: 'ClientA'
} as ConsumerVersionSelector],
publishVerificationResult: true,
pactBrokerUsername: 'admin',
pactBrokerPassword: 'password',
})
.verifyProvider()
.then((output) => {
console.log(output);
})
.then(() => {
expect("A").toEqual("A");
});
});
});
它看起来像version
并pacticipant
没有兑现。两个消费者的合同都是从契约经纪人那里提取的。日志有以下语句:
DEBUG: The pact at https://local/pactbroker/pacts/provider/DemoService/consumer/ClientA/pact-version/1d59c1e8b3944bb34c72cafd0de47e0b07162685 is being verified because it matches the following configured selection criterion: pacts for all consumer versions tagged 'master'
DEBUG: The pact at https://local/pactbroker/pacts/provider/DemoService/consumer/ClientB/pact-version/0713c326c33c47a08901c676c575244bfefd394a is being verified because it matches the following configured selection criterion: pacts for all consumer versions tagged 'master'
谢谢你的评论。