Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fallbackTag doesn't work and code throws NoPactsFoundException #1264

Open
iankurrathi opened this issue Dec 3, 2020 · 3 comments
Open

fallbackTag doesn't work and code throws NoPactsFoundException #1264

iankurrathi opened this issue Dec 3, 2020 · 3 comments

Comments

@iankurrathi
Copy link
Contributor

I am using 4.1.11 version of junit5 provider.

<dependency>
  <groupId>au.com.dius.pact.provider</groupId>
  <artifactId>junit5</artifactId>
  <version>4.1.11</version>
</dependency>

As per the documentation, I am specifying both tag and fallbackTag in my provider test class.

consumerVersionSelectors = {
                @VersionSelector(tag = "branch123", fallbackTag = "master")
        }

Now its supposed to use master tag contract if branch123 tag contract doesn't exist. However it doesn't work me and throws following error:

au.com.dius.pact.provider.junitsupport.loader.NoPactsFoundException: No Pact files were found to verify

I can confirm that master tag does exist from pact broker as well as using that in tag field and running the test successfully.

Looking at code of VersionSelector, it seems that does have fallbackTag() method, however when I go into PactBroker, consumerVersionSelectors() method doesn't seem to have any reference of fallbackTag:

https://github.com/pact-foundation/pact-jvm/blob/4_1_11/provider/src/main/java/au/com/dius/pact/provider/junitsupport/loader/VersionSelector.java

https://github.com/pact-foundation/pact-jvm/blob/4_1_11/provider/src/main/java/au/com/dius/pact/provider/junitsupport/loader/PactBroker.java

Thanks.

@uglyog
Copy link
Member

uglyog commented Dec 12, 2020

The fallback tag is passed on to the Pact broker. Can you provide debug level logs? It should show the request made to the Pact broker, as well as the response. Can you also confirm the version of your broker.

@iankurrathi
Copy link
Contributor Author

Pact broker version is 2.59.2.

Following are the debug level logs of provider:

2020-12-14 12:37:47,183 DEBUG PactVerificationInvocationContextProvider:37 [main] provideTestTemplateInvocationContexts called
2020-12-14 12:37:47,188 DEBUG PactVerificationInvocationContextProvider:69 [main] Verifying pacts for provider 'test-provider' and consumer 'test-consumer'
2020-12-14 12:37:47,557 DEBUG PactVerificationInvocationContextProvider:122 [main] Pact sources on test class:
 @au.com.dius.pact.provider.junitsupport.loader.PactSource(value=au.com.dius.pact.provider.junitsupport.loader.PactBrokerLoader.class)
2020-12-14 12:37:47,559 DEBUG             ProviderUtils:145 [main] Pact source does not have a constructor with one argument of type Class
2020-12-14 12:37:47,573 DEBUG          PactBrokerLoader:193 [main] Loading pacts from pact broker for provider test-provider and consumer version selectors [ConsumerVersionSelector(tag=branch123, latest=true, consumer=, fallbackTag=master)]
2020-12-14 12:37:47,576 DEBUG          PactBrokerLoader:299 [main] Authentication: None
2020-12-14 12:37:47,582 DEBUG                 HalClient:241 [main] Fetching: /
2020-12-14 12:37:48,758 DEBUG                 HalClient:241 [main] Fetching: /
2020-12-14 12:37:49,225 DEBUG                 HalClient:241 [main] Fetching: https://test-pact-broker.com/pacts/provider/test-provider/latest/branch123
2020-12-14 12:37:49,383 DEBUG                 HalClient:241 [main] Fetching: /
2020-12-14 12:37:49,874 DEBUG                 HalClient:241 [main] Fetching: https://test-pact-broker.com/pacts/provider/test-provider/latest

au.com.dius.pact.provider.junitsupport.loader.NoPactsFoundException: No Pact files were found to verify
Provider: test-provider
Consumer: test-consumer
Source: Pact Broker https://test-pact-broker.com: consumerVersionSelectors=[ConsumerVersionSelector(tag=branch123, latest=true, consumer=, fallbackTag=master)]

	at au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider.provideTestTemplateInvocationContexts(PactJUnit5VerificationProvider.kt:43)
	at org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor.lambda$execute$0(TestTemplateTestDescriptor.java:103)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
	at org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor.execute(TestTemplateTestDescriptor.java:107)
	at org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor.execute(TestTemplateTestDescriptor.java:42)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)


@uglyog
Copy link
Member

uglyog commented Jan 10, 2021

Your broker does not support the new "pacts for verification" endpoint, that is why the fallback tag is not being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants