1

I am creating a demo application for Groovy using Spring boot with Kafka and elastic. I used @EmbeddedKafka annotation in my Spock tests and they are working really nice locally; both on Windows and Ubuntu. They work from within Intellij by just running or debuggin, no issue. It's the same when trying in my shell "./gradlew test". Everything is good. As soon as I pushed it to github.com, my github action fails. But it's calling the same command.

the action definition: https://github.com/besessener/GroovySpringBootKafkaElasticsearchDemo/blob/main/.github/workflows/test.yml

remote failing test case: https://github.com/besessener/GroovySpringBootKafkaElasticsearchDemo/blob/main/src/test/groovy/me/spring/GroovyDemo/stream/KafkaSendAndReceiveTest.groovy

action: https://github.com/besessener/GroovySpringBootKafkaElasticsearchDemo/runs/3019862203?check_suite_focus=true

The only thing that looks like an error to me from the actions output, is this:

 2021-07-08 14:05:35.896  WARN 2693 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient   : [Consumer clientId=consumer-UserGroup-1, groupId=UserGroup] Error while fetching metadata with correlation id 4 : {topic-user=LEADER_NOT_AVAILABLE}

I read many things about not using static ports for the kafka tests. but this is my only kafka test, so I don't really understand how there should be a conflict. Furthermore LEADER_NOT_AVAILABLE could be a problem with a non-existing topic or maybe the consumer is simply not able to properly conenct to the broker. But I don't see any of this.

I still have the feeling it is more related to "localhost:9092" as brokerProperties. Is there an issue in regards to that when using Github actions? Or anything else I am missing?

Matthias
  • 1,200
  • 2
  • 13
  • 33
  • You could try running your tests in a container: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainer This would allow you to run the exact same container locally and thereby more closely replicate the setup your tests are running in github actions. – rethab Jul 08 '21 at 14:36
  • my container knowledge is so low, I would rather not start learning about it for "only" running Unit/partial-integration tests – Matthias Jul 08 '21 at 15:10

0 Answers0