Welcome to contributing developer guide

Feel free to contribute! Create a fork or report bug to improve this project

Prerequisites

Depends on your locally installed Docker you may see next testcontainers error:

2023-09-09 10:51:54.434 ERROR   main  [ d.DockerClientProviderStrategy ] - Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
        UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)As no valid configuration was found, execution cannot continue.
See https://www.testcontainers.org/on_failure.html for more details.

I fixed it on my mac like so:

sudo ln -s -v ~/.docker/run/docker.sock /var/run/docker.sock

Build and test

./mvnw clean ; ./mvnw verify

Integration test (H2 file)

rm -rf ~/.m2/repository/io/github/daggerok/example ~/.m2/repository/io/github/daggerok/liquibase-r2dbc-spring-boot-starter*
./mvnw clean install -DskipTests

./mvnw -f examples/h2/file spring-boot:start

http :8003
http :8003/api
http :8003/api/messages
http :8003/api/messages body=hey
http :8003/api/messages

./mvnw -f examples/h2/file spring-boot:stop

Integration test (H2 mem)

rm -rf ~/.m2/repository/io/github/daggerok/example ~/.m2/repository/io/github/daggerok/liquibase-r2dbc-spring-boot-starter*
./mvnw clean install -DskipTests

./mvnw -f examples/h2/mem spring-boot:start

http :8004
http :8004/api
http :8004/api/messages
http :8004/api/messages body=hey
http :8004/api/messages

./mvnw -f examples/h2/mem spring-boot:stop

Integration test (MySQL)

if [[ "" != `docker ps -aq` ]] ; then docker rm -f -v `docker ps -aq` ; fi

docker run -d --rm --name mysql --platform=linux/x86_64 \
  --health-cmd='mysqladmin ping -h 127.0.0.1 -u $MYSQL_USER --password=$MYSQL_PASSWORD || exit 1' \
  --health-start-period=1s --health-retries=1111 --health-interval=1s --health-timeout=5s \
  -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=database \
  -e MYSQL_USER=user -e MYSQL_PASSWORD=password \
  -p 3306:3306 \
  mysql:8.0.24

while [[ $(docker ps -n 1 -q -f health=healthy -f status=running | wc -l) -lt 1 ]] ; do
  sleep 3 ; echo -n '.'
done

sleep 15; echo 'MySQL is ready.'

rm -rf ~/.m2/repository/io/github/daggerok/example ~/.m2/repository/io/github/daggerok/liquibase-r2dbc-spring-boot-starter*
./mvnw clean install -DskipTests

./mvnw -f examples/mysql spring-boot:start

http :8001
http :8001/api
http :8001/api/messages
http :8001/api/messages body=hey
http :8001/api/messages

./mvnw -f examples/mysql spring-boot:stop
docker stop mysql

Integration test (Postgresql)

if [[ "" != `docker ps -aq` ]] ; then docker rm -f -v `docker ps -aq` ; fi

docker run -d --rm --name postgres -p 5432:5432 --platform=linux/x86_64 \
  -e POSTGRES_PASSWORD=password -e POSTGRES_DB=database -e POSTGRES_USER=user \
  --health-start-period=1s --health-retries=1111 --health-interval=1s --health-timeout=5s \
  --health-cmd='pg_isready -h 127.0.0.1 -p 5432 -d $POSTGRES_DB -U $POSTGRES_USER || exit 1' \
  postgres:14.3-alpine3.16

while [[ $(docker ps -n 1 -q -f health=healthy -f status=running | wc -l) -lt 1 ]] ; do
  sleep 3 ; echo -n '.'
done

rm -rf ~/.m2/repository/io/github/daggerok/example ~/.m2/repository/io/github/daggerok/liquibase-r2dbc-spring-boot-starter*
./mvnw clean install -DskipTests

./mvnw -f examples/postgresql spring-boot:start

http :8002
http :8002/api
http :8002/api/messages
http :8002/api/messages body=hey
http :8002/api/messages

./mvnw -f examples/postgresql spring-boot:stop
docker stop postgres

Integration test (MariaDB)

if [[ "" != `docker ps -aq` ]] ; then docker rm -f -v `docker ps -aq` ; fi

docker run -p 3306:3306 -d --rm --name mariadb --platform=linux/x86_64 \
  --env MARIADB_USER=user --env MARIADB_PASSWORD=password --env MARIADB_ROOT_PASSWORD=password --env MARIADB_DATABASE=database \
  --health-cmd='mysqladmin ping -h 127.0.0.1 -u $MARIADB_USER --password=$MARIADB_PASSWORD || exit 1' \
  --health-start-period=1s --health-retries=1111 --health-interval=1s --health-timeout=5s \
  mariadb:10.7.4

while [[ $(docker ps -n 1 -q -f health=healthy -f status=running | wc -l) -lt 1 ]] ; do
  sleep 3 ; echo -n '.'
done
echo 'MariaDB is ready.'

rm -rf ~/.m2/repository/io/github/daggerok/example ~/.m2/repository/io/github/daggerok/liquibase-r2dbc-spring-boot-starter*
./mvnw clean install -DskipTests

./mvnw -f examples/mariadb spring-boot:start

http :8005
http :8005/api
http :8005/api/messages
http :8005/api/messages body=hey
http :8005/api/messages

./mvnw -f examples/mariadb spring-boot:stop
Last Updated:
Contributors: Maksim Kostromin