找不到契约文件可以验证
我面临着奇怪的问题测试问题。但是,当我使用本地PACT-BROKR时,相同的测试正在通过时,当我使用远程PACT-BROKR测试时,则会失败。
systemProperty 'pactbroker.url', 'https://pact-broker.internal-dev.com/' // Test is failing
systemProperty 'pactbroker.url', 'http://localhost:9292/' // Test is passing, I have setup locally and published to it
错误:
No Pact files were found to verify
Provider: Provider1
Source: Pact Broker https://pact-broker.internal-dev.com/
au.com.dius.pact.provider.junitsupport.loader.NoPactsFoundException: No Pact files were found to verify
Provider: Provider1
Source: Pact Broker https://pact-broker.internal-dev.com/
at au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider.provideTestTemplateInvocationContexts(PactJUnit5VerificationProvider.kt:49)
at au.com.dius.pact.provider.spring.junit5.PactVerificationSpringProvider.provideTestTemplateInvocationContexts(PactVerificationSpringProvider.kt:24)
at org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor.lambda$execute$0(TestTemplateTestDescriptor.java:102) and more
有什么想法吗?
注意:这仅在一项服务中发生。对于所有其他服务,相同的设置工作正常,即使在本地经纪人主机中也可以正常工作。我试图调试和测试
即将为空。
//异常点tests.first
是空的,不应该是。当我使用Provider2
时,它不是空的。
override fun provideTestTemplateInvocationContexts(context: ExtensionContext): Stream<TestTemplateInvocationContext> {
logger.trace { "provideTestTemplateInvocationContexts called" }
val tests = resolvePactSources(context)
return when {
tests.first.isNotEmpty() -> tests.first.stream() as Stream<TestTemplateInvocationContext>
AnnotationSupport.isAnnotated(context.requiredTestClass, IgnoreNoPactsToVerify::class.java) ->
listOf(DummyTestTemplate).stream() as Stream<TestTemplateInvocationContext>
else -> throw NoPactsFoundException("No Pact files were found to verify\n${tests.second}")
}
}
当我使用提供商provider2
(这是针对其他服务)而不是provider1
(我需要这个)时,看来PACT已解决,并且不匹配测试的失败,此在设置的情况下,验证一切都很好。我猜这是版本控制问题,但不确定为什么要通过本地传递。我试图在出版商方面重命名提供商,并将其与新名称一起使用,但仍然相同。
I am facing weird issue for pact testing. When I use local pact-broker same test is passing however, when I use remote pact-broker test is failing.
systemProperty 'pactbroker.url', 'https://pact-broker.internal-dev.com/' // Test is failing
systemProperty 'pactbroker.url', 'http://localhost:9292/' // Test is passing, I have setup locally and published to it
Errors:
No Pact files were found to verify
Provider: Provider1
Source: Pact Broker https://pact-broker.internal-dev.com/
au.com.dius.pact.provider.junitsupport.loader.NoPactsFoundException: No Pact files were found to verify
Provider: Provider1
Source: Pact Broker https://pact-broker.internal-dev.com/
at au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider.provideTestTemplateInvocationContexts(PactJUnit5VerificationProvider.kt:49)
at au.com.dius.pact.provider.spring.junit5.PactVerificationSpringProvider.provideTestTemplateInvocationContexts(PactVerificationSpringProvider.kt:24)
at org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor.lambda$execute$0(TestTemplateTestDescriptor.java:102) and more
Any idea?
Note: This is happening to only one service. For all other services, same setup is working fine and even this is working fine in local broker host. I tried to debug and tests
is coming empty.
// Exception point tests.first
is empty which should not be. It is not empty when I use Provider2
which for different service.
override fun provideTestTemplateInvocationContexts(context: ExtensionContext): Stream<TestTemplateInvocationContext> {
logger.trace { "provideTestTemplateInvocationContexts called" }
val tests = resolvePactSources(context)
return when {
tests.first.isNotEmpty() -> tests.first.stream() as Stream<TestTemplateInvocationContext>
AnnotationSupport.isAnnotated(context.requiredTestClass, IgnoreNoPactsToVerify::class.java) ->
listOf(DummyTestTemplate).stream() as Stream<TestTemplateInvocationContext>
else -> throw NoPactsFoundException("No Pact files were found to verify\n${tests.second}")
}
}
When I used the provider Provider2
(this is for other service) instead of Provider1
(I need this), looks like pact is getting resolved and failing for not matching tests, this verifies everything is good in case of setup. I guess somehow it is versioning issue but not sure why passing in local. I tried to rename the provider in publisher side and use it with new name, still same issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论