Explorar o código

Update Docker image for Silverpeas version 6.1

The test of the Silverpeas image is also updated by replacing the H2 database
by PostgreSQL as this latter is the more common database used in the Silverpeas
ecosystem.
silveruser %!s(int64=5) %!d(string=hai) anos
pai
achega
2419389e1c
Modificáronse 2 ficheiros con 35 adicións e 8 borrados
  1. 4 1
      library/silverpeas
  2. 31 7
      test/tests/silverpeas-basics/run.sh

+ 4 - 1
library/silverpeas

@@ -2,6 +2,9 @@
 Maintainers: Miguel Moquillon <[email protected]> (@mmoqui)
 Maintainers: Miguel Moquillon <[email protected]> (@mmoqui)
 GitRepo: https://github.com/Silverpeas/docker-silverpeas-prod.git
 GitRepo: https://github.com/Silverpeas/docker-silverpeas-prod.git
 
 
-Tags: 6.0.2, latest
+Tags: 6.1, latest
+GitCommit: 7d002ee69a68f8a8f640ce7fbf7fd47b526123d0
+
+Tags: 6.0.2
 GitCommit: 189a4f2db783d5052add54f2c07ca7a3b860c685
 GitCommit: 189a4f2db783d5052add54f2c07ca7a3b860c685
 
 

+ 31 - 7
test/tests/silverpeas-basics/run.sh

@@ -12,18 +12,41 @@ if ! docker image inspect "$clientImage" &> /dev/null; then
 	docker pull "$clientImage" > /dev/null
 	docker pull "$clientImage" > /dev/null
 fi
 fi
 
 
+# run a PostgresSQL container
+dbname="postgresql-container-$RANDOM-$RANDOM"
+dbid="$(
+  docker run -d \
+    --name "$dbname" \
+    -e POSTGRES_PASSWORD=silverpeas \
+    postgres:12.3
+)"
+trap "docker rm -vf $dbid > /dev/null" EXIT
+
+check_db_running() {
+	docker exec "$dbid" psql -U postgres -d 'postgres' -c 'SELECT 1'
+}
+
+# wait for PostgreSQL to be ran
+. "$dir/../../retry.sh" --tries 20 --sleep 5 'check_db_running'
+
+# create the database for testing Silverpeas
+docker exec "$dbid" psql -U postgres -c 'create database silverpeas' > /dev/null
+
 cname="silverpeas-container-$RANDOM-$RANDOM"
 cname="silverpeas-container-$RANDOM-$RANDOM"
 # when running the first time, a silverpeas process is spawn before starting Silverpeas
 # when running the first time, a silverpeas process is spawn before starting Silverpeas
 # (this configuration process can take some time)
 # (this configuration process can take some time)
 cid="$(
 cid="$(
-	docker run -d \
-		--name "$cname" \
-		-e DB_SERVERTYPE='H2' \
-		-e DB_SERVER=':file:' \
-		-e DB_PASSWORD='sa' \
-		"$image"
+  docker run -d \
+    --name "$cname" \
+    --link "$dbid":database \
+    -e DB_SERVERTYPE=POSTGRESQL \
+    -e DB_NAME=silverpeas \
+    -e DB_SERVER=database \
+    -e DB_USER=postgres \
+    -e DB_PASSWORD=silverpeas \
+    "$image"
 )"
 )"
-trap "docker rm -vf $cid > /dev/null" EXIT
+trap "docker rm -vf $cid $dbid > /dev/null" EXIT
 
 
 check_running() {
 check_running() {
 	docker run --rm \
 	docker run --rm \
@@ -32,6 +55,7 @@ check_running() {
 		curl -fs http://silverpeas:8000/silverpeas > /dev/null
 		curl -fs http://silverpeas:8000/silverpeas > /dev/null
 }
 }
 
 
+# wait for the Silverpeas starting to be completed
 . "$dir/../../retry.sh" --tries 20 --sleep 5 'check_running'
 . "$dir/../../retry.sh" --tries 20 --sleep 5 'check_running'
 
 
 expected='Configured: [OK] Running:    [OK] Active:     [OK]  INFO: JBoss is running '
 expected='Configured: [OK] Running:    [OK] Active:     [OK]  INFO: JBoss is running '