ewolff / microservice-kafka

Demo to show how Apache Kafka can be used for communication between microservices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

project builds, but tests fail

DanStadlerNewRelic opened this issue · comments

Hi, I wanted to try out your project, so cloned and tried out the how-to-run section. When the tests run after the build, there is a long period of getting these messages:

2019-09-30 19:51:25.888 WARN 88574 --- [ main] org.apache.kafka.clients.NetworkClient : [Consumer clientId=consumer-1, groupId=test] Connection to node -1 could not be established. Broker may not be available.

When the tests do end, this is the final output:

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.234 s - in com.ewolff.microservice.order.kafka.OrderKafkaTest
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] OrderServiceTest.lastCreatedIsUpdated » IllegalState Failed to load Applicatio...
[INFO]
[ERROR] Tests run: 5, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] microservice-kafka ................................. SUCCESS [ 0.558 s]
[INFO] microservice-kafka-order ........................... FAILURE [02:19 min]
[INFO] microservice-kafka-shipping ........................ SKIPPED
[INFO] microservice-kafka-invoicing ....................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:20 min
[INFO] Finished at: 2019-09-30T19:43:11-07:00
[INFO] Final Memory: 42M/157M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project microservice-kafka-order: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/dstadler/Documents/code/k8s-mcsvs-java/microservice-kafka/microservice-kafka/microservice-kafka-order/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :microservice-kafka-order
C02Z65TVLVDQ:microservice-kafka dstadler$

Please refer to the trouble shooting tips in the build section:

The tests use some ports on the local machine. Make sure that no server runs in the background.

Skip the tests: ./mvnw clean package -Dmaven.test.skip=true or mvnw.cmd clean package -Dmaven.test.skip=true (Windows).

Please reopen the issue if this doesn't work.

can you please offer more detail on this part: "The tests use some ports on the local machine. Make sure that no server runs in the background."

Do you mean a kafka server? I am pretty sure I'm not running it at all on this laptop.

Just to help me understand, what is the exact test I should be executing to ensure that "no server runs in the background"?

Also, I did try to run without the tests, i.e.

./mvnw clean package -Dmaven.test.skip=true

. That succeeds. However I still fail at the docker stage, as listed in the other bug I opened.

thanks -
Dan

I updated the documentation concerning the ports, see 8b7894a .

I reassured that in fact docker-compose build does work once the maven build has completed successfully. So I am afraid I cannot reproduce your problem.