Another question, now that my consumer tests for t...
# pact-jvm
b
Another question, now that my consumer tests for the workshop are updated, I want to upgrade the provider side, too. I've got a simple Spring service there that I'd like to reuse, so I've upgraded my dependencies to:
Copy code
<dependency>
            <groupId>au.com.dius.pact</groupId>
            <artifactId>provider</artifactId>
            <version>4.6.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>au.com.dius.pact.provider</groupId>
            <artifactId>junit5spring</artifactId>
            <version>4.6.2</version>
            <scope>test</scope>
        </dependency>
and I'm following the example here: https://docs.pact.io/implementation_guides/jvm/provider/junit5spring However, I'm probably missing one or more dependencies here:
Copy code
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Provider("address_provider")
@PactFolder("src/test/pacts")
public class ContractTest {

    @TestTemplate
    @ExtendWith(PactVerificationSpringProvider.class)
    public void pactVerificationTestTemplate(PactVerificationContext context) {
        context.verifyInteraction();
    }
}
as it can't find the
@Provider
,
PactVerificationSpringProvider
and
PactVerificationContext
classes. Again, probably something pretty obvious but I've been stuck on this for a while now. I know that page references Pact v 4.4.x so that might be the problem but I'd really like to use the latest versions.
m
Any chance you could help Bas @uglyog?
u
No idea, those classes and annotations haven't changed. 4.6.2 requires min JDK 17, so check that you have that.
🤔 1
m
How are you running it Bas - command line? Mind sharing the logs/console?
b
There's not a lot to run as the code doesn't compile 🙂 I've now 'downgraded' (or rather upgraded less) to
4.4.6
and that resolves these issues. I am running on Java 17, by the way.
🤔 1
Quick test shows that upgrading to 4.5.3 also breaks the project as these classes I mentioned cannot be found. Really weird. For now I'm happy to stick with 4.4.6 but I'd love to hear what causes this behaviour.
🤔 1
b
To what, exactly? 4.0.10 seems to be the latest version
Hmmm, still no success when using
4.6.2
for all dependencies, but
4.4.6
works. Again, happy to use that, but I'm really curious to see what causes this. Would love consumer and provider sides to be on the same (latest) Pact version for the workshop.
💯 1
Also, I see this in the console output. Doesn't impact the outcome, though:
Copy code
Given Customer GET: the address ID matches an existing address
  A request for address data
Exception in thread "Thread-6" java.lang.NoClassDefFoundError: org/apache/commons/codec/digest/DigestUtils
        at au.com.dius.pact.core.support.Metrics.hostnameHash(Metrics.kt:152)
        at au.com.dius.pact.core.support.Metrics.sendMetrics$lambda-2(Metrics.kt:106)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.digest.DigestUtils
        ... 3 more
    returns a response which
      has status code 200 (OK)
      has a matching body (OK)
Not sure if that's related. I've pushed the latest code to the branch I linked to just earlier.
Any ideas on this? I’ve got a working workshop codebase now so that’s good, but the provider project is still on 4.4.6 instead of the latest version. My OCD does not agree with this.
1000000 1
m
Hi Bas, I’ll see if we can take a look tomorrow. Hopefully something simple!
❤️ 1
I… understand the compulsion 😛
🤣 2
y
Just having a look now, on a mac m1, openjdk 17 and maven both installed via homebrew. managed to run all the tests out the box, and then upgraded to 4.6.2 on the provider and that passed too. Just added some local ci runs to replicate and then will push up a fork.
b
Cheers Saf! Really curious to see what I’ve done wrong, the only thing I haven’t tried is completely wiping and repopulating my local Maven repo.
y
I just dropped into the repo, updated the pom.xml and did a
mvn test
again. Just did a
mvn clean
and then
mvn test
just incase it didn’t rebuild after changing the pom
could just be an environmental / transient thing elmo shrug sometimes resetting my pc works for reasons I wish we could fathom in this modern day
b
Thanks! I’ll check first thing tomorrow morning as I CBA to fire up my laptop again tonight
y
also just tested against a docker image.
maven:3-eclipse-temurin-17
linux arm and amd64. I’ll just up some repros so you can have a nose tomorrow. enjoy the feet up 👍
❤️ 1
b
I’m on Windows so that might just be a factor here too 😆
b
Legend! Again, I’ll check this out first thing tomorrow morning
j
Exactly the same problem here, @Bas Dijkstra what did you do to fix? Thank you
b
@Jorge Casto Núñez de Castro Cobo I’m still using Pact 4.4.x for the provider. Not the solution I prefer but as it’s for a workshop I’m running in just over a week it’ll do.
j
oh... 😔