Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

# Tests disabled due to flakiness with under resourced github test machines. Confluent Jira works fine. Will fix later.
name: CI compile only - Java 8 (IT disabled atm, unit tests only)
name: Java 8 (unit tests only)

on:
push:
Expand All @@ -12,7 +12,26 @@ on:

jobs:
build:

strategy:
fail-fast: false
matrix:
# Why not? because we can.
# 2.0.1, 2.1.1, 2.2.2, 2.3.1, 2.4.1 don't work - needs zstd and some kafka client libs.
# Doesn't mean it couldn't be modified slightly to work...
ak: [2.5.1, 2.6.1]
jdk: ['-P jvm8-release -Djvm8.location=/opt/hostedtoolcache/jdk/8.0.282/x64', '']
experimental: [false]
name: ["Stable AK version"]
include:
- ak: "'[2.4.1,2.5)'" # currently failing
experimental: true
name: "Oldest AK breaking version 2.4.1+ (below 2.5.0) expected to fail"
- ak: "'[2.7.0,4)'" # currently failing
experimental: true
name: "Newest AK version 2.7.0+ expected to fail"

continue-on-error: ${{ matrix.experimental }}
name: "${{ matrix.name }} (AK: ${{ matrix.ak }}) experimental? ${{ matrix.experimental }}"
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -71,8 +90,9 @@ jobs:
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2

- name: Test with Maven on Java 8
run: mvn -B package -P jvm8-release -Djvm8.location=/opt/hostedtoolcache/jdk/8.0.282/x64
- name: Test with Maven
#run: mvn -B package -P jvm8-release -Djvm8.location=/opt/hostedtoolcache/jdk/8.0.282/x64 -Dkafka.version=${{ matrix.ak }}
run: mvn -B package ${{ matrix.jdk }} -Dkafka.version=${{ matrix.ak }}
# - name: Test with Maven on Java 9
# run: mvn -B package -P jvm9-release -Djvm9.location=/opt/hostedtoolcache/jdk/9.0.7/x64
# - name: Test with Maven on Java
Expand Down
3 changes: 3 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ See what profiles are active::
See what plugins or dependencies are available to be updated::
`mvn versions:display-plugin-updates versions:display-property-updates versions:display-dependency-updates`

Run a single unit test::
`mvn -Dtest=TestCircle test`

Run a specific integration test method in a submodule project, skipping unit tests::
`mvn -Dit.test=TransactionAndCommitModeTest#testLowMaxPoll -DskipUTs=true verify -DfailIfNoTests=false --projects parallel-consumer-core`

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.confluent.csid.utils;

import lombok.extern.slf4j.Slf4j;
import org.assertj.core.presentation.StandardRepresentation;
import org.junit.jupiter.api.Test;
import org.slf4j.helpers.MessageFormatter;

import java.util.Map;
import java.util.Properties;

import static io.confluent.csid.utils.StringTestUtils.pretty;

@Slf4j
class JavaEnvTest {

/**
* Used to check the java environment at runtime
*/
@Test
void checkJavaEnvironment() {
log.error("Java all env: {}", pretty(System.getProperties().entrySet()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.confluent.csid.utils;

import lombok.experimental.UtilityClass;
import org.assertj.core.presentation.StandardRepresentation;

@UtilityClass
public class StringTestUtils {

public static final StandardRepresentation STANDARD_REPRESENTATION = new StandardRepresentation();

public static String pretty(Object properties) {
return STANDARD_REPRESENTATION.toStringOf(properties);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.apache.kafka.clients.consumer.*;
import org.apache.kafka.clients.producer.MockProducer;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.serialization.Serdes;
import org.junit.jupiter.api.BeforeEach;
import pl.tlinkowski.unij.api.UniLists;
import pl.tlinkowski.unij.api.UniMaps;
Expand Down Expand Up @@ -126,7 +127,8 @@ protected MockConsumer<String, String> setupClients() {

protected void instantiateConsumerProducer() {
LongPollingMockConsumer<String, String> consumer = new LongPollingMockConsumer<>(OffsetResetStrategy.EARLIEST);
MockProducer<String, String> producer = new MockProducer<>(true, null, null); // TODO do async testing
MockProducer<String, String> producer = new MockProducer<>(true,
Serdes.String().serializer(), Serdes.String().serializer()); // TODO do async testing

this.producerSpy = spy(producer);
this.consumerSpy = spy(consumer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import org.apache.kafka.clients.producer.MockProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.common.serialization.Serializer;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
Expand Down Expand Up @@ -81,7 +83,8 @@ Consumer<String, String> getKafkaConsumer() {

@Override
Producer<String, String> getKafkaProducer() {
return new MockProducer<>(true, null, null);
var stringSerializer = Serdes.String().serializer();
return new MockProducer<>(true, stringSerializer, stringSerializer);
}

@Override
Expand Down
14 changes: 13 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

<!-- core -->
<slf4j.version>1.7.30</slf4j.version>
<kafka.version>2.5.0</kafka.version>
<kafka.version>2.5.1</kafka.version>
<version.unij>0.1.3</version.unij>

<!-- tests -->
Expand Down Expand Up @@ -645,6 +645,18 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>tree</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

<!-- Management -->
Expand Down
3 changes: 3 additions & 0 deletions src/docs/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@ See what profiles are active::
See what plugins or dependencies are available to be updated::
`mvn versions:display-plugin-updates versions:display-property-updates versions:display-dependency-updates`

Run a single unit test::
`mvn -Dtest=TestCircle test`

Run a specific integration test method in a submodule project, skipping unit tests::
`mvn -Dit.test=TransactionAndCommitModeTest#testLowMaxPoll -DskipUTs=true verify -DfailIfNoTests=false --projects parallel-consumer-core`

Expand Down