Commit 015363e9 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

CircleCI 2.0 saga: Finally, use a Docker-container-hosted PostgreSQL (and...

CircleCI 2.0 saga: Finally, use a Docker-container-hosted PostgreSQL (and SQLite) to do the DB testing.
parent 30ae7ecb
...@@ -12,3 +12,6 @@ RUN pip2 install SQLAlchemy psycopg2 ...@@ -12,3 +12,6 @@ RUN pip2 install SQLAlchemy psycopg2
COPY requirements.txt /tmp/ COPY requirements.txt /tmp/
RUN pip3 install -r /tmp/requirements.txt RUN pip3 install -r /tmp/requirements.txt
RUN apt-get install less RUN apt-get install less
RUN apt-get install -y postgresql
COPY setup_testdb.sh /tmp/
RUN /tmp/setup_testdb.sh
/etc/init.d/postgresql start
su - postgres -c 'createuser ubuntu;'
echo "ALTER USER ubuntu WITH PASSWORD 'tastedb';" | su - postgres -c 'psql -w'
echo '127.0.0.1:5432:*:ubuntu:tastedb' > ~/.pgpass
chmod 0600 ~/.pgpass
echo "GRANT ALL PRIVILEGES ON DATABASE postgres TO ubuntu;" | su - postgres -c 'psql -w'
echo "ALTER USER ubuntu CREATEDB;" | su - postgres -c 'psql -w'
...@@ -2,7 +2,9 @@ all: cleanDB test ...@@ -2,7 +2,9 @@ all: cleanDB test
cleanDB: cleanDB:
# PostgreSQL # PostgreSQL
echo 'drop database if exists circle_test; create database circle_test;' | psql -h 127.0.0.1 -U ubuntu postgres || exit 1 /etc/init.d/postgresql restart
# Since postgres takes a while to start, do this until it succeeds
bash -c "while 1 ; do echo 'drop database if exists circle_test; create database circle_test;' | psql -h 127.0.0.1 -U ubuntu postgres && break ; done"
rm -f sql.log rm -f sql.log
# #
# MySQL (is a toy - disabled related tests) # MySQL (is a toy - disabled related tests)
......
Markdown is supported
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