Skip to content

Commit

Permalink
Merge pull request #17 from GoodforGod/dev
Browse files Browse the repository at this point in the history
[0.9.4]
  • Loading branch information
GoodforGod authored Dec 19, 2023
2 parents 4a9a351 + 961eedc commit 2667479
Show file tree
Hide file tree
Showing 22 changed files with 70 additions and 42 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ subprojects {
testLogging {
events("passed", "skipped", "failed")
exceptionFormat("full")
showStandardStreams(false)
showStandardStreams(true)
}

reports {
Expand Down
4 changes: 2 additions & 2 deletions cassandra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Features:

**Gradle**
```groovy
testImplementation "io.goodforgod:testcontainers-extensions-cassandra:0.9.2"
testImplementation "io.goodforgod:testcontainers-extensions-cassandra:0.9.4"
```

**Maven**
```xml
<dependency>
<groupId>io.goodforgod</groupId>
<artifactId>testcontainers-extensions-cassandra</artifactId>
<version>0.9.2</version>
<version>0.9.4</version>
<scope>test</scope>
</dependency>
```
Expand Down
3 changes: 2 additions & 1 deletion cassandra/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<appender-ref ref="ASYNC"/>
</root>

<logger level="DEBUG" name="org.testcontainers"/>
<logger level="INFO" name="org.testcontainers"/>
<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="TRACE" name="io.goodforgod.testcontainers.extensions"/>
</configuration>
4 changes: 2 additions & 2 deletions cockroachdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Features:

**Gradle**
```groovy
testImplementation "io.goodforgod:testcontainers-extensions-cockroachdb:0.9.2"
testImplementation "io.goodforgod:testcontainers-extensions-cockroachdb:0.9.4"
```

**Maven**
```xml
<dependency>
<groupId>io.goodforgod</groupId>
<artifactId>testcontainers-extensions-cockroachdb</artifactId>
<version>0.9.2</version>
<version>0.9.4</version>
<scope>test</scope>
</dependency>
```
Expand Down
3 changes: 2 additions & 1 deletion cockroachdb/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<appender-ref ref="ASYNC"/>
</root>

<logger level="DEBUG" name="org.testcontainers"/>
<logger level="INFO" name="org.testcontainers"/>
<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="TRACE" name="io.goodforgod.testcontainers.extensions"/>
</configuration>
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
groupId=io.goodforgod
artifactRootId=testcontainers-extensions
artifactVersion=0.9.3-SNAPSHOT
artifactVersion=0.9.4-SNAPSHOT


##### GRADLE #####
Expand Down
3 changes: 2 additions & 1 deletion jdbc/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<appender-ref ref="ASYNC"/>
</root>

<logger level="DEBUG" name="org.testcontainers"/>
<logger level="INFO" name="org.testcontainers"/>
<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="TRACE" name="io.goodforgod.testcontainers.extensions"/>
</configuration>
4 changes: 2 additions & 2 deletions kafka/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Features:

**Gradle**
```groovy
testImplementation "io.goodforgod:testcontainers-extensions-kafka:0.9.2"
testImplementation "io.goodforgod:testcontainers-extensions-kafka:0.9.4"
```

**Maven**
```xml
<dependency>
<groupId>io.goodforgod</groupId>
<artifactId>testcontainers-extensions-kafka</artifactId>
<version>0.9.2</version>
<version>0.9.4</version>
<scope>test</scope>
</dependency>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ static final class ConsumerImpl implements Consumer {
} catch (Exception e) {
return Collections.<String, List<PartitionInfo>>emptyMap();
}
},
result -> new HashSet<>(result.keySet()).containsAll(this.topics));
}, result -> new HashSet<>(result.keySet()).containsAll(this.topics));
logger.debug("KafkaConsumer topics {} assigned", this.topics);

logger.trace("KafkaConsumer topics {} poll starting", this.topics);
Expand Down Expand Up @@ -361,8 +360,7 @@ void close() {
kafkaNetworkProperties.putAll(props.properties());
kafkaNetworkProperties.putAll(properties);
return kafkaNetworkProperties;
})
.orElse(null);
}).orElse(null);

return new KafkaConnectionClosableImpl(kafkaProperties, networkProperties);
}
Expand Down Expand Up @@ -433,6 +431,7 @@ public void send(@NotNull String topic, @NotNull List<Event> events) {
try {
return admin.describeTopics(topics).allTopicNames().get(10, TimeUnit.SECONDS);
} catch (Exception e) {
logger.warn(e.getMessage());
return Collections.<String, TopicDescription>emptyMap();
}
}, result -> result.values().stream().map(TopicDescription::name).collect(Collectors.toSet())
Expand Down Expand Up @@ -508,26 +507,45 @@ static void createTopicsIfNeeded(@NotNull Admin admin, @NotNull Set<String> topi
if (!topicsToCreate.isEmpty()) {
logger.trace("Topics {} creating...", topics);
var result = admin.createTopics(topicsToCreate);
result.all().get(2, TimeUnit.MINUTES);
logger.info("Required topics {} created", topics);
result.all().get(1, TimeUnit.MINUTES);
logger.info("Topics {} created", topics);
} else if (reset && !topicsToReset.isEmpty()) {
logger.trace("Required topics {} already exist, but require reset, resetting...", topicsToReset);
logger.trace("Topics {} already exist, but require reset, resetting...", topicsToReset);
admin.deleteTopics(topicsToReset).all().get(1, TimeUnit.MINUTES);
logger.debug("Topics {} reset success", topicsToReset);

var topicsToCreateAfterReset = topicsToReset.stream()
.map(topic -> new NewTopic(topic, Optional.of(1), Optional.empty()))
.collect(Collectors.toSet());

logger.trace("Topics {} reset status check...", topicsToReset);
Awaitility.await()
.atMost(Duration.ofSeconds(35))
.pollInterval(Duration.ofMillis(100))
.until(() -> {
try {
return admin.describeTopics(topics).allTopicNames().get(10, TimeUnit.SECONDS);
} catch (Exception e) {
logger.warn(e.getMessage());
return Collections.<String, TopicDescription>emptyMap();
}
}, result -> result.values().stream()
.map(TopicDescription::name)
.filter(topicsToReset::contains)
.findFirst()
.isEmpty());
logger.debug("Topics {} reset status check success", topicsToReset);

logger.trace("Topics {} recreating...", topicsToReset);
Awaitility.await().atMost(Duration.ofSeconds(30))
Awaitility.await().atMost(Duration.ofSeconds(35))
.pollInterval(Duration.ofMillis(50))
.until(() -> {
try {
admin.createTopics(topicsToCreateAfterReset).all().get(10, TimeUnit.SECONDS);
return true;
} catch (ExecutionException e) {
if (e.getCause() instanceof TopicExistsException) {
Thread.sleep(500);
return false;
} else {
throw new KafkaConnectionException("Kafka Admin operation failed for topics: " + topics, e);
Expand All @@ -537,18 +555,18 @@ static void createTopicsIfNeeded(@NotNull Admin admin, @NotNull Set<String> topi
}
});

logger.info("Required topics {} recreated", topicsToReset);
logger.info("Topics {} recreated", topicsToReset);
} else {
logger.debug("Required topics already exist: {}", topics);
logger.debug("Topics already exist: {}", topics);
}
} catch (ExecutionException e) {
if (e.getCause() instanceof TopicExistsException) {
logger.trace("Required topics already exist exception received: {}", topics);
logger.trace("Topics already exist exception received: {}", topics);
} else {
throw new KafkaConnectionException("Kafka Admin operation failed for topics: " + topics, e);
}
} catch (TopicExistsException e) {
logger.trace("Required topics already exist exception received: {}", topics);
logger.trace("Topics already exist exception received: {}", topics);
} catch (Exception e) {
throw new KafkaConnectionException("Kafka Admin operation failed for topics: " + topics, e);
}
Expand Down
3 changes: 2 additions & 1 deletion kafka/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</root>

<logger level="WARN" name="org.apache.kafka"/>
<logger level="DEBUG" name="org.testcontainers"/>
<logger level="INFO" name="org.testcontainers"/>
<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="TRACE" name="io.goodforgod.testcontainers.extensions"/>
</configuration>
4 changes: 2 additions & 2 deletions mariadb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Features:

**Gradle**
```groovy
testImplementation "io.goodforgod:testcontainers-extensions-mariadb:0.9.2"
testImplementation "io.goodforgod:testcontainers-extensions-mariadb:0.9.4"
```

**Maven**
```xml
<dependency>
<groupId>io.goodforgod</groupId>
<artifactId>testcontainers-extensions-mariadb</artifactId>
<version>0.9.2</version>
<version>0.9.4</version>
<scope>test</scope>
</dependency>
```
Expand Down
3 changes: 2 additions & 1 deletion mariadb/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<appender-ref ref="ASYNC"/>
</root>

<logger level="DEBUG" name="org.testcontainers"/>
<logger level="INFO" name="org.testcontainers"/>
<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="TRACE" name="io.goodforgod.testcontainers.extensions"/>
</configuration>
4 changes: 2 additions & 2 deletions mockserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Features:

**Gradle**
```groovy
testImplementation "io.goodforgod:testcontainers-extensions-mockserver:0.9.2"
testImplementation "io.goodforgod:testcontainers-extensions-mockserver:0.9.4"
```

**Maven**
```xml
<dependency>
<groupId>io.goodforgod</groupId>
<artifactId>testcontainers-extensions-mockserver</artifactId>
<version>0.9.2</version>
<version>0.9.4</version>
<scope>test</scope>
</dependency>
```
Expand Down
3 changes: 2 additions & 1 deletion mockserver/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<appender-ref ref="ASYNC"/>
</root>

<logger level="DEBUG" name="org.testcontainers"/>
<logger level="INFO" name="org.testcontainers"/>
<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="TRACE" name="io.goodforgod.testcontainers.extensions"/>
</configuration>
4 changes: 2 additions & 2 deletions mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Features:

**Gradle**
```groovy
testImplementation "io.goodforgod:testcontainers-extensions-mysql:0.9.2"
testImplementation "io.goodforgod:testcontainers-extensions-mysql:0.9.4"
```

**Maven**
```xml
<dependency>
<groupId>io.goodforgod</groupId>
<artifactId>testcontainers-extensions-mysql</artifactId>
<version>0.9.2</version>
<version>0.9.4</version>
<scope>test</scope>
</dependency>
```
Expand Down
3 changes: 2 additions & 1 deletion mysql/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<appender-ref ref="ASYNC"/>
</root>

<logger level="DEBUG" name="org.testcontainers"/>
<logger level="INFO" name="org.testcontainers"/>
<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="TRACE" name="io.goodforgod.testcontainers.extensions"/>
</configuration>
4 changes: 2 additions & 2 deletions oracle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Features:

**Gradle**
```groovy
testImplementation "io.goodforgod:testcontainers-extensions-oracle:0.9.2"
testImplementation "io.goodforgod:testcontainers-extensions-oracle:0.9.4"
```

**Maven**
```xml
<dependency>
<groupId>io.goodforgod</groupId>
<artifactId>testcontainers-extensions-oracle</artifactId>
<version>0.9.2</version>
<version>0.9.4</version>
<scope>test</scope>
</dependency>
```
Expand Down
3 changes: 2 additions & 1 deletion oracle/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<appender-ref ref="ASYNC"/>
</root>

<logger level="DEBUG" name="org.testcontainers"/>
<logger level="INFO" name="org.testcontainers"/>
<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="TRACE" name="io.goodforgod.testcontainers.extensions"/>
</configuration>
4 changes: 2 additions & 2 deletions postgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Features:

**Gradle**
```groovy
testImplementation "io.goodforgod:testcontainers-extensions-postgres:0.9.2"
testImplementation "io.goodforgod:testcontainers-extensions-postgres:0.9.4"
```

**Maven**
```xml
<dependency>
<groupId>io.goodforgod</groupId>
<artifactId>testcontainers-extensions-postgres</artifactId>
<version>0.9.2</version>
<version>0.9.4</version>
<scope>test</scope>
</dependency>
```
Expand Down
3 changes: 2 additions & 1 deletion postgres/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<appender-ref ref="ASYNC"/>
</root>

<logger level="DEBUG" name="org.testcontainers"/>
<logger level="INFO" name="org.testcontainers"/>
<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="TRACE" name="io.goodforgod.testcontainers.extensions"/>
</configuration>
4 changes: 2 additions & 2 deletions redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Features:

**Gradle**
```groovy
testImplementation "io.goodforgod:testcontainers-extensions-redis:0.9.2"
testImplementation "io.goodforgod:testcontainers-extensions-redis:0.9.4"
```

**Maven**
```xml
<dependency>
<groupId>io.goodforgod</groupId>
<artifactId>testcontainers-extensions-redis</artifactId>
<version>0.9.2</version>
<version>0.9.4</version>
<scope>test</scope>
</dependency>
```
Expand Down
3 changes: 2 additions & 1 deletion redis/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<appender-ref ref="ASYNC"/>
</root>

<logger level="DEBUG" name="org.testcontainers"/>
<logger level="INFO" name="org.testcontainers"/>
<logger level="WARN" name="org.testcontainers.containers"/>
<logger level="TRACE" name="io.goodforgod.testcontainers.extensions"/>
</configuration>

0 comments on commit 2667479

Please sign in to comment.