Fix postgres CI test
This commit is contained in:
parent
da7413a92e
commit
8e830c0bff
1 changed files with 9 additions and 2 deletions
|
@ -12,6 +12,7 @@ IMAGE_TAR="${CACHE_DIR}/${IMAGE}-${IMAGE_TAG}.tar.gz"
|
||||||
|
|
||||||
MYSQL_IMAGE="mysql:5.7"
|
MYSQL_IMAGE="mysql:5.7"
|
||||||
POSTGRES_IMAGE="postgres:9.6"
|
POSTGRES_IMAGE="postgres:9.6"
|
||||||
|
POSTGRES_CONTAINER="test_postgres"
|
||||||
|
|
||||||
export MYSQL_ROOT_PASSWORD="quay"
|
export MYSQL_ROOT_PASSWORD="quay"
|
||||||
export MYSQL_USER="quay"
|
export MYSQL_USER="quay"
|
||||||
|
@ -110,7 +111,7 @@ postgres_ping() {
|
||||||
|
|
||||||
|
|
||||||
postgres_start() {
|
postgres_start() {
|
||||||
docker run --net=host -d -e POSTGRES_USER -e POSTGRES_PASSWORD \
|
docker run --name="${POSTGRES_CONTAINER}" --net=host -d -e POSTGRES_USER -e POSTGRES_PASSWORD \
|
||||||
-e POSTGRES_DB "${POSTGRES_IMAGE}"
|
-e POSTGRES_DB "${POSTGRES_IMAGE}"
|
||||||
|
|
||||||
if ! (sleep 10 && postgres_ping); then
|
if ! (sleep 10 && postgres_ping); then
|
||||||
|
@ -120,6 +121,11 @@ postgres_start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
postgres_init() {
|
||||||
|
docker exec "${POSTGRES_CONTAINER}" psql -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -c 'CREATE EXTENSION IF NOT EXISTS pg_trgm;'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
postgres() {
|
postgres() {
|
||||||
TEST_DATABASE_URI="postgresql://"
|
TEST_DATABASE_URI="postgresql://"
|
||||||
TEST_DATABASE_URI+="${POSTGRES_USER}:${POSTGRES_PASSWORD}"
|
TEST_DATABASE_URI+="${POSTGRES_USER}:${POSTGRES_PASSWORD}"
|
||||||
|
@ -129,6 +135,7 @@ postgres() {
|
||||||
|
|
||||||
load_image
|
load_image
|
||||||
postgres_start
|
postgres_start
|
||||||
|
postgres_init
|
||||||
quay_run make full-db-test
|
quay_run make full-db-test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue