Pact consumer tests (customer-service, order-service) do not use the Pact mock server

Open
#143 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java, spring-boot
Domain
testing-qa

Research direction

Start with CustomerConsumerContractTest and OrderConsumerContractTest in the customer-service and order-service modules; the @Pact method is present but @PactTestFor and @PactVerification are missing or commented out. Check the account-service.ribbon properties in the test configuration and replace them with current client settings pointing at the mock server. Done when running the consumer tests generates pact files under the pact.rootDir location that account-service provider tests can read.

Written by the indexing model from the issue text.

Description

bug

Problem

CustomerConsumerContractTest and OrderConsumerContractTest define a @Pact method, but there is no @PactTestFor and @PactVerification is commented out. The contract is therefore not verified and no pact file is generated from it. The tests only pass if something happens to respond on port 8092.

The properties account-service.ribbon.listOfServers / account-service.ribbon.eureka.enabled are leftovers from Ribbon, which no longer exists in Spring Cloud 2025.x.

Suggested solution

  • Add @PactTestFor(providerName = ..., port = ...) (or inject MockServer) so the test calls the Pact mock server.
  • Point the client at the mock server through current properties (no Ribbon).
  • Make sure the generated pacts are written to a known location (pact.rootDir) so provider tests in account-service can consume them.
Dominant language
Java
Stars
12
Forks
7
PR merge metrics
No merged PRs in 30d

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from piomin/sample-spring-cloud-testing

All issues in piomin/sample-spring-cloud-testing

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.