Fix postgres CI test

This commit is contained in:
Sida Chen 2019-03-11 11:25:35 -04:00
parent da7413a92e
commit 8e830c0bff

View file

@ -12,6 +12,7 @@ IMAGE_TAR="${CACHE_DIR}/${IMAGE}-${IMAGE_TAG}.tar.gz"
MYSQL_IMAGE="mysql:5.7"
POSTGRES_IMAGE="postgres:9.6"
POSTGRES_CONTAINER="test_postgres"
export MYSQL_ROOT_PASSWORD="quay"
export MYSQL_USER="quay"
@ -110,7 +111,7 @@ postgres_ping() {
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}"
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() {
TEST_DATABASE_URI="postgresql://"
TEST_DATABASE_URI+="${POSTGRES_USER}:${POSTGRES_PASSWORD}"
@ -129,6 +135,7 @@ postgres() {
load_image
postgres_start
postgres_init
quay_run make full-db-test
}