Add dockerised tests

This commit is contained in:
Derry Hamilton 2019-06-17 12:53:31 +01:00
parent 3badb97d49
commit 5571bd1b4d
14 changed files with 143 additions and 76 deletions

View file

@ -8,17 +8,24 @@ RUN cd ujetl && mvn package
#FROM centos:centos7
FROM openjdk:8-alpine
MAINTAINER Derry Hamilton <derryh@rasilon.net>
FROM openjdk:8-alpine as runner
LABEL maintainer="Derry Hamilton <derryh@rasilon.net>"
#RUN yum -y install epel-release
#RUN yum -y install java-1.8.0-openjdk-devel
RUN apk update && apk upgrade && apk add bash
RUN mkdir -p /usr/share/ujetl/lib/ /var/ujetl /etc/ujetl
COPY --from=builder /ujetl/target/CopyingApp-2.*-jar-with-dependencies.jar /usr/share/ujetl/lib/CopyingApp.jar
COPY --from=builder /ujetl/install_extra/copying_defaults_log4j.xml /etc/ujetl/
COPY docker/multistage/ujetl_entrypoint /
ENTRYPOINT ["/ujetl_entrypoint"]
COPY ujetl_entrypoint /
CMD ["/ujetl_entrypoint"]
FROM runner as tester
COPY TEST_config_live.xml /var/ujetl/
COPY wait_for_postgres /
RUN apk add postgresql-client
FROM runner as deploy
# Convice docker cloud to build the deploy image

View file

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<CopyingApp>
<hardLimitSeconds>360000</hardLimitSeconds>
<nRowsToLog>10000</nRowsToLog>
<blockSize>1000</blockSize>
<source>
<dsn>jdbc:postgresql://testdb:5432/test</dsn>
<username>test</username>
<password>test</password>
<networkTimeout>600000</networkTimeout>
</source>
<dest>
<dsn>jdbc:postgresql://testdb:5432/test</dsn>
<username>test</username>
<password>test</password>
</dest>
<jobs>
<job>
<name>test</name>
<key>select coalesce(-1,max(id),-1) as key from dest</key>
<select>
select
id,
test_int,
test_text,
test_ts
from
public.source where id > ?::bigint</select>
<insert>
insert into public.dest(
id,
test_int,
test_text,
test_ts
)values(
?::bigint,
?::integer,
?::text,
?::timestamp with time zone
)ON CONFLICT(id) DO UPDATE
set
test_int = EXCLUDED.test_int,
test_text = EXCLUDED.test_text,
test_ts = EXCLUDED.test_ts
WHERE
dest.test_int = EXCLUDED.test_int
OR dest.test_text = EXCLUDED.test_text
OR dest.test_ts = EXCLUDED.test_ts
</insert>
</job>
</jobs>
</CopyingApp>

View file

@ -4,6 +4,10 @@ set -e
LOG_PROPS=/etc/ujetl/copying_defaults_log4j.xml
cd /var/ujetl
echo Currently in `pwd`
echo processing files:
ls
echo Starting run loop
for file in *.xml
do
/usr/bin/java \

View file

@ -0,0 +1,12 @@
#!/bin/bash
set -e
cmd="$@"
until PGPASSWORD=test psql -h "testdb" -U "test" -c 'SELECT 1 FROM public.container_ready' postgres; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done
>&2 echo "Postgres is up - executing command"
exec $cmd