From ef94567fb13d441c98da1c8e655c7ab3017e2a79 Mon Sep 17 00:00:00 2001 From: fejera Date: Sun, 17 Nov 2019 15:04:03 +0100 Subject: [PATCH 1/4] added live-all profile to root pom --- pom.xml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pom.xml b/pom.xml index bc4c38f386..63561cb65e 100644 --- a/pom.xml +++ b/pom.xml @@ -1671,6 +1671,39 @@ + + + live-all + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/SpringContextTest.java + **/*UnitTest.java + **/*IntegrationTest.java + **/*IntTest.java + **/*LongRunningUnitTest.java + **/*ManualTest.java + **/*JdbcTest.java + + + **/*LiveTest.java + + + + + + + + + + + + From 8f342596723eff31d0d68ce08df44a7493437120 Mon Sep 17 00:00:00 2001 From: fejera Date: Sun, 17 Nov 2019 15:05:58 +0100 Subject: [PATCH 2/4] added live-test resources --- persistence-modules/spring-data-mongodb/live-test.sh | 11 +++++++++++ .../spring-data-mongodb/live-test/Dockerfile | 8 ++++++++ .../spring-data-mongodb/live-test/init-session.js | 1 + 3 files changed, 20 insertions(+) create mode 100755 persistence-modules/spring-data-mongodb/live-test.sh create mode 100644 persistence-modules/spring-data-mongodb/live-test/Dockerfile create mode 100644 persistence-modules/spring-data-mongodb/live-test/init-session.js diff --git a/persistence-modules/spring-data-mongodb/live-test.sh b/persistence-modules/spring-data-mongodb/live-test.sh new file mode 100755 index 0000000000..bb513a90bb --- /dev/null +++ b/persistence-modules/spring-data-mongodb/live-test.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +docker image build -t spring-data-mongodb:live-test live-test/ + +docker run -p 27017:27017 --name spring-data-mongodb-live-test -it spring-data-mongodb:live-test +#wait + +mvn clean compile test -P live-all + +docker stop spring-data-mongodb-live-test +docker rm spring-data-mongodb-live-test diff --git a/persistence-modules/spring-data-mongodb/live-test/Dockerfile b/persistence-modules/spring-data-mongodb/live-test/Dockerfile new file mode 100644 index 0000000000..9e3634feb0 --- /dev/null +++ b/persistence-modules/spring-data-mongodb/live-test/Dockerfile @@ -0,0 +1,8 @@ +FROM mongo:4.2.1 + +COPY init-session.js /docker-entrypoint-initdb.d/ + +EXPOSE 27017 + +HEALTHCHECK --interval=5s --timeout=3s --start-period=10s CMD mongo db.stats() +CMD ["mongod", "--replSet", "rs0"] diff --git a/persistence-modules/spring-data-mongodb/live-test/init-session.js b/persistence-modules/spring-data-mongodb/live-test/init-session.js new file mode 100644 index 0000000000..2e968884cc --- /dev/null +++ b/persistence-modules/spring-data-mongodb/live-test/init-session.js @@ -0,0 +1 @@ +rs.initiate(); From 6080f679c762e3258f33eb13673dd9fb501c2287 Mon Sep 17 00:00:00 2001 From: fejera Date: Sun, 24 Nov 2019 12:42:59 +0100 Subject: [PATCH 3/4] cleaned up and documented live testing script usage --- persistence-modules/spring-data-mongodb/LIVE-TEST.md | 9 +++++++++ .../spring-data-mongodb/live-test-setup.sh | 5 +++++ .../spring-data-mongodb/live-test-teardown.sh | 4 ++++ persistence-modules/spring-data-mongodb/live-test.sh | 8 -------- 4 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 persistence-modules/spring-data-mongodb/LIVE-TEST.md create mode 100644 persistence-modules/spring-data-mongodb/live-test-setup.sh create mode 100644 persistence-modules/spring-data-mongodb/live-test-teardown.sh diff --git a/persistence-modules/spring-data-mongodb/LIVE-TEST.md b/persistence-modules/spring-data-mongodb/LIVE-TEST.md new file mode 100644 index 0000000000..9da1ea249e --- /dev/null +++ b/persistence-modules/spring-data-mongodb/LIVE-TEST.md @@ -0,0 +1,9 @@ +========= + +## Spring Data MongoDB Live Testing + + +There are 3 scripts to simplify running live tests: +1. `live-test-setup.sh` builds a docker image with the necessary setup and runs it. The environment is ready, when the log stops - it takes approximately 30 seconds. +2. `live-test.sh` runs the live tests (but no other tests). +3. `live-test-setup.sh` stops and removes the docker image. diff --git a/persistence-modules/spring-data-mongodb/live-test-setup.sh b/persistence-modules/spring-data-mongodb/live-test-setup.sh new file mode 100644 index 0000000000..37e6c48dbd --- /dev/null +++ b/persistence-modules/spring-data-mongodb/live-test-setup.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +docker image build -t spring-data-mongodb:live-test live-test/ + +docker run -p 27017:27017 --name spring-data-mongodb-live-test spring-data-mongodb:live-test diff --git a/persistence-modules/spring-data-mongodb/live-test-teardown.sh b/persistence-modules/spring-data-mongodb/live-test-teardown.sh new file mode 100644 index 0000000000..a29163bc7a --- /dev/null +++ b/persistence-modules/spring-data-mongodb/live-test-teardown.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker stop spring-data-mongodb-live-test +docker rm spring-data-mongodb-live-test diff --git a/persistence-modules/spring-data-mongodb/live-test.sh b/persistence-modules/spring-data-mongodb/live-test.sh index bb513a90bb..5a079bdac8 100755 --- a/persistence-modules/spring-data-mongodb/live-test.sh +++ b/persistence-modules/spring-data-mongodb/live-test.sh @@ -1,11 +1,3 @@ #!/bin/bash -docker image build -t spring-data-mongodb:live-test live-test/ - -docker run -p 27017:27017 --name spring-data-mongodb-live-test -it spring-data-mongodb:live-test -#wait - mvn clean compile test -P live-all - -docker stop spring-data-mongodb-live-test -docker rm spring-data-mongodb-live-test From f3405e0daac9662355c31d66935db65515a29ce4 Mon Sep 17 00:00:00 2001 From: fejera Date: Mon, 2 Dec 2019 10:18:42 +0100 Subject: [PATCH 4/4] moved live test resources to src/live-test/resources --- persistence-modules/spring-data-mongodb/live-test-setup.sh | 2 +- .../{live-test => src/live-test/resources}/Dockerfile | 0 .../{live-test => src/live-test/resources}/init-session.js | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename persistence-modules/spring-data-mongodb/{live-test => src/live-test/resources}/Dockerfile (100%) rename persistence-modules/spring-data-mongodb/{live-test => src/live-test/resources}/init-session.js (100%) diff --git a/persistence-modules/spring-data-mongodb/live-test-setup.sh b/persistence-modules/spring-data-mongodb/live-test-setup.sh index 37e6c48dbd..e8e0437083 100644 --- a/persistence-modules/spring-data-mongodb/live-test-setup.sh +++ b/persistence-modules/spring-data-mongodb/live-test-setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -docker image build -t spring-data-mongodb:live-test live-test/ +docker image build -t spring-data-mongodb:live-test src/live-test/resources/ docker run -p 27017:27017 --name spring-data-mongodb-live-test spring-data-mongodb:live-test diff --git a/persistence-modules/spring-data-mongodb/live-test/Dockerfile b/persistence-modules/spring-data-mongodb/src/live-test/resources/Dockerfile similarity index 100% rename from persistence-modules/spring-data-mongodb/live-test/Dockerfile rename to persistence-modules/spring-data-mongodb/src/live-test/resources/Dockerfile diff --git a/persistence-modules/spring-data-mongodb/live-test/init-session.js b/persistence-modules/spring-data-mongodb/src/live-test/resources/init-session.js similarity index 100% rename from persistence-modules/spring-data-mongodb/live-test/init-session.js rename to persistence-modules/spring-data-mongodb/src/live-test/resources/init-session.js