Activate surefire plugin and remove unnecessary configuration
This commit is contained in:
parent
1f5a9eff6d
commit
1ae0e8d994
22
pom.xml
22
pom.xml
@ -22,11 +22,10 @@
|
||||
<junit.jupiter.version>5.3.2</junit.jupiter.version>
|
||||
<docker-maven-plugin.version>0.27.2</docker-maven-plugin.version>
|
||||
<jgitflow-maven-plugin.version>1.0-m5.1</jgitflow-maven-plugin.version>
|
||||
<spring-boot-starter.version>2.1.1.RELEASE</spring-boot-starter.version>
|
||||
<spring-boot.version>2.1.3.RELEASE</spring-boot.version>
|
||||
<spring.kafka.version>2.2.4.RELEASE</spring.kafka.version>
|
||||
|
||||
<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
|
||||
<maven-failsafe-plugin.version>2.22.1</maven-failsafe-plugin.version>
|
||||
<assertj-core.version>3.11.1</assertj-core.version>
|
||||
<guava.version>27.1-jre</guava.version>
|
||||
</properties>
|
||||
@ -35,7 +34,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<version>${spring-boot-starter.version}</version>
|
||||
<version>${spring-boot.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -77,7 +76,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<version>2.1.2.RELEASE</version>
|
||||
<version>${spring-boot.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -102,6 +101,10 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven-surefire-plugin.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>external.atlassian.jgitflow</groupId>
|
||||
<artifactId>jgitflow-maven-plugin</artifactId>
|
||||
@ -138,15 +141,4 @@
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>releases</id>
|
||||
<url>http://nexus.device-insight.de/nexus/content/repositories/releases</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>snapshots</id>
|
||||
<url>http://nexus.device-insight.de/nexus/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
</project>
|
||||
|
@ -1,28 +0,0 @@
|
||||
spring:
|
||||
jackson:
|
||||
serialization:
|
||||
write-dates-as-timestamps: false
|
||||
|
||||
management:
|
||||
server:
|
||||
port: 9090
|
||||
metrics:
|
||||
export:
|
||||
prometheus:
|
||||
enabled: true
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include:
|
||||
- health
|
||||
- info
|
||||
- prometheus
|
||||
- loggers
|
||||
- httptrace
|
||||
- configprops
|
||||
- metrics
|
||||
- heapdump
|
||||
- threaddump
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
@ -6,10 +6,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import kafka.server.KafkaServer;
|
||||
import org.apache.kafka.clients.consumer.Consumer;
|
||||
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
@ -29,7 +26,6 @@ import java.util.Map;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@EmbeddedKafka(topics = {TOPIC})
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
public class KafkaConsumingHealthIndicatorTest {
|
||||
|
||||
static final String TOPIC = "health-checks";
|
||||
@ -39,7 +35,7 @@ public class KafkaConsumingHealthIndicatorTest {
|
||||
@Autowired
|
||||
private EmbeddedKafkaBroker embeddedKafkaBroker;
|
||||
|
||||
@BeforeAll
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
Map<String, Object> consumerConfigs =
|
||||
new HashMap<>(KafkaTestUtils.consumerProps("consumer", "false", embeddedKafkaBroker));
|
||||
@ -49,7 +45,7 @@ public class KafkaConsumingHealthIndicatorTest {
|
||||
consumer.poll(Duration.ofSeconds(1));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
consumer.close();
|
||||
embeddedKafkaBroker.getKafkaServers().forEach(KafkaServer::shutdown);
|
||||
@ -58,14 +54,14 @@ public class KafkaConsumingHealthIndicatorTest {
|
||||
|
||||
@Test
|
||||
public void kafkaIsDown() throws Exception {
|
||||
KafkaHealthProperties kafkaHealthProperties = new KafkaHealthProperties();
|
||||
final KafkaHealthProperties kafkaHealthProperties = new KafkaHealthProperties();
|
||||
kafkaHealthProperties.setTopic(TOPIC);
|
||||
|
||||
final KafkaProperties kafkaProperties = new KafkaProperties();
|
||||
BrokerAddress[] brokerAddresses = embeddedKafkaBroker.getBrokerAddresses();
|
||||
final BrokerAddress[] brokerAddresses = embeddedKafkaBroker.getBrokerAddresses();
|
||||
kafkaProperties.setBootstrapServers(Collections.singletonList(brokerAddresses[0].toString()));
|
||||
|
||||
KafkaConsumingHealthIndicator healthIndicator =
|
||||
final KafkaConsumingHealthIndicator healthIndicator =
|
||||
new KafkaConsumingHealthIndicator(kafkaHealthProperties, kafkaProperties.buildConsumerProperties(),
|
||||
kafkaProperties.buildProducerProperties());
|
||||
healthIndicator.subscribeToTopic();
|
||||
@ -74,6 +70,9 @@ public class KafkaConsumingHealthIndicatorTest {
|
||||
assertThat(health.getStatus()).isEqualTo(Status.UP);
|
||||
|
||||
shutdownKafka();
|
||||
|
||||
health = healthIndicator.health();
|
||||
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
|
||||
}
|
||||
|
||||
private void shutdownKafka() {
|
||||
|
Loading…
Reference in New Issue
Block a user