Skip to content

WeMaLa/spring-boot-elastic-docker-integration-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This example shows how integration testing with SpringBoot 2, Kotlin and Elasticsearch can be accomplished using Docker.

Requirements

  • Java 11
  • Maven >= 3.2.1

Executions

Unit testing

Maven test phase will apply all unit tests - in this demo UserTest.kt and UserRepositoryMockTest

mvn clean test

Integrations testing

Maven verify phase will apply all unit tests and all integration tests - in this demo UserTest.kt, UserRepositoryMockTest and UserRepositoryIT.kt

mvn clean verify

Build artifact

Maven package phase will build a local artifact and applies only unit tests

mvn clean package

Install artifact

Maven install phase will build an artifact, install it to local repository and applies unit and integration tests. Skipping tests will not skip starting an elasticsearch docker container.

mvn clean install

Local integration test debugging

Debugging by an IDE will not start an elasticsearch container. The test container must be installed and started by yourself.

First install and run

To reduce resources, it is suggested that the container be launched in Developing mode

docker pull docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.4
docker run -p 9200:9200 -p 9300:9300 --name it-elasticsearch -e "discovery.type=single-node" -e "xpack.security.enabled=false"  docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.4

Start and stop an installed image

docker start it-elasticsearch
docker stop it-elasticsearch

About

A simple project to run elasticsearch in docker while integration testing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages