Skip to content
Snippets Groups Projects
Commit 812bac4f authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

Trying to add some tests

parent 4c918f03
No related branches found
No related tags found
No related merge requests found
CREATE SCHEMA IF NOT EXISTS meta;
CREATE TABLE IF NOT EXISTS meta.meta_variables (
ID serial NOT NULL PRIMARY KEY,
source varchar(256) UNIQUE NOT NULL,
hierarchy json NOT NULL
);
INSERT INTO meta.meta_variables (source, hierarchy) VALUES (
'adni',
'
{
"code": "root",
"groups": [{
"code": "tg1",
"label": "Test Group 1",
"groups": [{
"code": "tg3",
"label": "Test Group 3",
"variables": [{
"code": "tv1",
"label": "Test Variable 1",
"type": "text"
}]
}]
}, {
"code": "tg2",
"label": "Test Group 2",
"groups": [{
"code": "tg4",
"label": "Test Group 4",
"variables": [{
"code": "tv2",
"label": "Test Variable 2",
"type": "integer"
}, {
"code": "tv3",
"label": "Test Variable 3",
"type": "real"
}]
}]
}]
}
'
);
#!/bin/sh
# This script will be executed when Postgres starts
echo "host all all fe80::/10 md5" >> /var/lib/postgresql/data/pg_hba.conf
#!/usr/bin/env bash
# Kill old containers
docker kill backend-test
docker kill portal-db-test
docker rm -f portal-db-test
docker kill science-db-test
docker kill portal-backend-test
docker rm -f portal-backend-test
# Remove old containers
docker rm -f backend-test
docker rm -f portal-db-test
docker rm -f science-db-test
#!/usr/bin/env bash
# Kill old containers
if [ $(docker ps | grep backend-test | wc -l) -gt 0 ]; then
docker kill backend-test
fi
if [ $(docker ps | grep portal-db-test | wc -l) -gt 0 ]; then
docker kill portal-db-test
fi
if [ $(docker ps -a | grep portal-db-test | wc -l) -gt 0 ]; then
docker rm -f portal-db-test
if [ $(docker ps | grep science-db-test | wc -l) -gt 0 ]; then
docker kill science-db-test
fi
if [ $(docker ps | grep portal-backend-test | wc -l) -gt 0 ]; then
docker kill portal-backend-test
# Remove old containers
if [ $(docker ps -a | grep backend-test | wc -l) -gt 0 ]; then
docker rm -f backend-test
fi
if [ $(docker ps -a | grep portal-db-test | wc -l) -gt 0 ]; then
docker rm -f portal-db-test
fi
if [ $(docker ps -a | grep portal-backend-test | wc -l) -gt 0 ]; then
docker rm -f portal-backend-test
if [ $(docker ps -a | grep science-db-test | wc -l) -gt 0 ]; then
docker rm -f science-db-test
fi
docker run --name portal-db-test -p 5432:5432 -e POSTGRES_USER=postgres -d postgres:9.5.3
echo "Waiting for DB to start..."
# Run databases containers
docker run --name science-db-test -p 65432:5432 -v /science-db/sql:/docker-entrypoint-initdb.d/ -e POSTGRES_USER=science -d postgres:9.5.3
docker run --name portal-db-test -p 65433:5432 -v /meta-db/sql:/docker-entrypoint-initdb.d/ -e POSTGRES_USER=portal -d postgres:9.5.3
# Get gateway IP
GATEWAY_IP=$(docker inspect science-db-test | grep \"Gateway\":\ \" | sed 's/.*Gateway\":\ \"\([^-]*\)\",/\1/' | head -n 1)
echo "Gateway IP: $GATEWAY_IP"
# Wait for databases to be ready
echo "Waiting for science-db to start..."
until [ $(docker exec science-db-test psql -U postgres -c "\q" 2>&1 | wc -l) -eq 0 ]; do
printf '.'
sleep 1
done
echo ""
echo "Waiting for portal-db to start..."
until [ $(docker exec portal-db-test psql -U postgres -c "\q" 2>&1 | wc -l) -eq 0 ]; do
printf '.'
sleep 1
done
echo ""
GATEWAY_IP=$(docker inspect portal-db-test | grep \"Gateway\":\ \" | sed 's/.*Gateway\":\ \"\([^-]*\)\",/\1/' | head -n 1)
docker run --name portal-backend-test -p 8080:8080 \
# Run backend container
docker run --name backend-test -p 65434:8080 \
-e "PORTAL_DB_URL=jdbc:postgresql://$GATEWAY_IP:65433/portal" \
-e "PORTAL_DB_SERVER=$GATEWAY_IP:65433/portal" \
-e "PORTAL_DB_USER=portal" \
-e "META_DB_URL=jdbc:postgresql://$GATEWAY_IP:65433/portal" \
-e "META_DB_SERVER=$GATEWAY_IP:65433/portal" \
-e "META_DB_USER=portal" \
-e "SCIENCE_DB_URL=jdbc:postgresql://$GATEWAY_IP:65432/science" \
-e "SCIENCE_DB_SERVER=$GATEWAY_IP:65432/science" \
-e "SCIENCE_DB_USER=science" \
-e "CONTEXT_PATH=/services" \
-e "AUTHENTICATION=0" \
-e "PORTAL_DB_URL=jdbc:postgresql://$GATEWAY_IP:5433/postgres" \
-e "META_DB_URL=jdbc:postgresql://$GATEWAY_IP:5432/postgres" \
-d hbpmip/portal-backend
-d hbpmip/portal-backend:latest
# Wait for backend to be ready
echo "Waiting for backend to start..."
until [ $(docker logs portal-backend-test | grep "Started MIPApplication" | wc -l) -eq 1 ]; do
until [ $(docker logs backend-test | grep "Started MIPApplication" | wc -l) -eq 1 ]; do
printf '.'
sleep 1
done
SET datestyle to 'European';
CREATE SCHEMA IF NOT EXISTS science;
CREATE TABLE science.ADNI_MERGE
(
tv1 char(256),
tv2 numeric,
tv3 numeric,
CONSTRAINT pk_adni_merge PRIMARY KEY (tv2)
)
WITH (
OIDS=FALSE
);
COPY science.ADNI_MERGE FROM '/docker-entrypoint-initdb.d/values.csv' CSV HEADER;
#!/bin/sh
# This script will be executed when Postgres starts
echo "host all all fe80::/10 md5" >> /var/lib/postgresql/data/pg_hba.conf
"tv1","tv2","tv3"
"val1",1,0.1
"val2",2,0.2
"val3",3,0.3
"val4",4,0.4
#!/usr/bin/env bash
# Get gateway IP
GATEWAY_IP=$(docker inspect portal-db-test | grep \"Gateway\":\ \" | sed 's/.*Gateway\":\ \"\([^-]*\)\",/\1/' | head -n 1)
# if [ "$(curl -s $GATEWAY_IP:8080/services/groups)" != "$groups" ]; then
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment