From 8e830c0bff9e57521a0c2bd777d0b8c5cc513298 Mon Sep 17 00:00:00 2001 From: Sida Chen Date: Mon, 11 Mar 2019 11:25:35 -0400 Subject: [PATCH] Fix postgres CI test --- scripts/ci | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/ci b/scripts/ci index 1d21607dc..bbbbe7322 100755 --- a/scripts/ci +++ b/scripts/ci @@ -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,13 +111,18 @@ 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 echo "PostgreSQL failed to respond in time." exit 1 - fi + fi +} + + +postgres_init() { + docker exec "${POSTGRES_CONTAINER}" psql -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -c 'CREATE EXTENSION IF NOT EXISTS pg_trgm;' } @@ -129,6 +135,7 @@ postgres() { load_image postgres_start + postgres_init quay_run make full-db-test }