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

Expected a PactSource, but got ... #23

Open
darccide opened this issue Mar 31, 2021 · 4 comments
Open

Expected a PactSource, but got ... #23

darccide opened this issue Mar 31, 2021 · 4 comments

Comments

@darccide
Copy link

Hello, I am trying to walk through this tutorial. However, when I try to verify a pact (./gradlew ...:pactVerify) I get an error and the following message: Expected a PactSource, but got /Users/mycomputer/Documents/pact-workshop-jvm/providers/springboot-provider/build/pacts/Our Little Consumer-Our Provider.json

I am assuming that there is an issue with accessing the actual Pact, but not entirely sure how to remedy it. The Pact has been created and exists in the above file path.

Thanks!

@jiangjunjoshua
Copy link

jiangjunjoshua commented Apr 12, 2021

I am running into the same issue in step4

Expected a PactSource, but got /Users/mycomputer/github/pact-workshop-jvm/providers/springboot-provider/build/pacts/OurLittleConsumer-OurProvider.json
Failed to load pact file
kotlin.KotlinNullPointerException

It looks like pact is a pretty good solution for contract testing.
I am looking forward to being unblocked and continue hands-on the exciting journey.

@darccide
Copy link
Author

I haven't heard anything from Pact. I will repost here if I am ever able to get unblocked.

@mefellows
Copy link
Contributor

Hi folks, apologies it looks like we didn't have issue notifications setup for this.

Please note that this repo has been recently superceded by https://github.com/pact-foundation/pact-workshop-jvm-spring, which is more aligned to our other workshops. I'll update our main docs to reflect this (docs.pact.io and in the README here).

But, the issue remains. I'm not sure what the specific issue is with this workshop (@uglyog any ideas?)

This is the truncated stacktrace from step 4:

➜ pact-workshop-jvm git:(step4) ✗ ./gradlew :providers:springboot-provider:pactVerify aws:pact-prod

Task :providers:springboot-provider:startProvider

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' |
| .__|| ||| |_, | / / / /
=========|
|==============|/=////
:: Spring Boot :: (v2.3.1.RELEASE)

2021-04-19 14:29:50.354 INFO 66414 --- [ main] a.c.d.p.s.MainApplication : Starting MainApplication on macfellows-2.local with PID 66414 (/Users/matthewfellows/development/public/pact-workshop-jvm/providers/springboot-provider/build/libs/springboot-provider.jar started by matthewfellows in /Users/matthewfellows/development/public/pact-workshop-jvm)
2021-04-19 14:29:50.357 INFO 66414 --- [ main] a.c.d.p.s.MainApplication : No active profile set, falling back to default profiles: default
2021-04-19 14:29:51.919 INFO 66414 --- [ main] o.s.b.w.e.j.JettyServletWebServerFactory : Server initialized with port: 8080
2021-04-19 14:29:51.923 INFO 66414 --- [ main] org.eclipse.jetty.server.Server : jetty-9.4.29.v20200521; built: 2020-05-21T17:20:40.598Z; git: 77c232aed8a45c818fd27232278d9f95a021095e; jvm 15.0.2+7
2021-04-19 14:29:51.958 INFO 66414 --- [ main] o.e.j.s.h.ContextHandler.application : Initializing Spring embedded WebApplicationContext
2021-04-19 14:29:51.958 INFO 66414 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1550 ms
2021-04-19 14:29:52.205 INFO 66414 --- [ main] org.eclipse.jetty.server.session : DefaultSessionIdManager workerName=node0
2021-04-19 14:29:52.206 INFO 66414 --- [ main] org.eclipse.jetty.server.session : No SessionScavenger set, using defaults
2021-04-19 14:29:52.207 INFO 66414 --- [ main] org.eclipse.jetty.server.session : node0 Scavenging every 600000ms
2021-04-19 14:29:52.213 INFO 66414 --- [ main] o.e.jetty.server.handler.ContextHandler : Started o.s.b.w.e.j.JettyEmbeddedWebAppContext@71812481{application,/,[file:///private/var/folders/3l/vsf3kf6n3yd_p40kwn_1883c0000gn/T/jetty-docbase.12913061056801299117.8080/],AVAILABLE}
2021-04-19 14:29:52.214 INFO 66414 --- [ main] org.eclipse.jetty.server.Server : Started @2725ms
2021-04-19 14:29:52.357 INFO 66414 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-04-19 14:29:52.568 INFO 66414 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-04-19 14:29:52.602 INFO 66414 --- [ main] o.e.j.s.h.ContextHandler.application : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-04-19 14:29:52.602 INFO 66414 --- [ main] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-04-19 14:29:52.607 INFO 66414 --- [ main] o.s.web.servlet.DispatcherServlet : Completed initialization in 5 ms
2021-04-19 14:29:52.631 INFO 66414 --- [ main] o.e.jetty.server.AbstractConnector : Started ServerConnector@7fd7a283{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2021-04-19 14:29:52.633 INFO 66414 --- [ main] o.s.b.web.embedded.jetty.JettyWebServer : Jetty started on port(s) 8080 (http/1.1) with context path '/'
2021-04-19 14:29:52.647 INFO 66414 --- [ main] a.c.d.p.s.MainApplication : Started MainApplication in 2.725 seconds (JVM running for 3.158)
java -jar /Users/matthewfellows/development/public/pact-workshop-jvm/providers/springboot-provider/build/libs/springboot-provider.jar is ready.

Task :providers:springboot-provider:pactVerify_Our_Provider FAILED
Expected a PactSource, but got /Users/matthewfellows/development/public/pact-workshop-jvm/providers/springboot-provider/build/pacts/Our Little Consumer-Our Provider.json
Failed to load pact file
java.lang.NullPointerException
at au.com.dius.pact.provider.ProviderVerifier.loadPactFileForConsumer(ProviderVerifier.kt:744)
at au.com.dius.pact.provider.ProviderVerifier.runVerificationForConsumer(ProviderVerifier.kt:671)
at au.com.dius.pact.provider.ProviderVerifier.runVerificationForConsumer$default(ProviderVerifier.kt:669)
at au.com.dius.pact.provider.ProviderVerifier.verifyProvider(ProviderVerifier.kt:649)
at au.com.dius.pact.provider.gradle.PactVerificationBaseTask.runVerification(PactVerificationBaseTask.kt:11)
at au.com.dius.pact.provider.gradle.PactVerificationTask.verifyPact(PactVerificationTask.groovy:49)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)

I was able to get it to pass as follows

      hasPactsWith('Our Little Consumer') {
        pactFileLocation = file("$buildDir/pacts/")
      }

Does that indicate a bug with the pactSource property?

@uglyog
Copy link

uglyog commented Apr 19, 2021

I raised an issue on the Pact-JVM repo to address this

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

4 participants