Skip to content

Commit

Permalink
Configure Oracle continuous integration
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 authored and nyalldawson committed Jan 2, 2020
1 parent 8d4ef80 commit e5fd756
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 8 deletions.
12 changes: 11 additions & 1 deletion .ci/travis/linux/docker-compose.travis.yml
Expand Up @@ -11,6 +11,16 @@ services:
- SSL_KEY_FILE=/etc/ssl/private/postgres_key.key
- SSL_CA_FILE=/etc/ssl/certs/issuer_ca_cert.pem

oracle:
image: oslandia/oracle-for-qgis-tests:18.4.0-xe
environment:
- ORACLE_SID=XE
- ORACLE_PWD=adminpass
- ORACLE_PDB=ORCLPDBTEST
- ORACLE_CHARACTERSET=AL32UTF8
ports:
- 1521:1521

# Proving very fragile!
# mssql:
# image: microsoft/mssql-server-linux:2017-latest
Expand All @@ -25,7 +35,7 @@ services:
- ${TRAVIS_BUILD_DIR}:/root/QGIS
links:
- postgres
- oracle
# - mssql
env_file:
- docker-variables.env

4 changes: 4 additions & 0 deletions .ci/travis/linux/scripts/docker-qgis-build.sh
Expand Up @@ -52,6 +52,10 @@ cmake \
-DWITH_DESKTOP=ON \
-DWITH_BINDINGS=ON \
-DWITH_SERVER=ON \
-DWITH_ORACLE=ON \
-DENABLE_ORACLETEST=ON \
-DORACLE_INCLUDEDIR="/instantclient_19_3/sdk/include/" \
-DORACLE_LIBDIR="/instantclient_19_3/" \
-DDISABLE_DEPRECATED=ON \
-DPYTHON_TEST_WRAPPER="timeout -sSIGSEGV 55s"\
-DCXX_EXTRA_FLAGS="${CLANG_WARNINGS}" \
Expand Down
25 changes: 21 additions & 4 deletions .ci/travis/linux/scripts/docker-qgis-test.sh
Expand Up @@ -17,7 +17,7 @@ export PGPASSWORD=docker
export PGDATABASE=qgis_test

# wait for the DB to be available
echo "Wait a moment while loading the database."
echo "Wait a moment while loading PostGreSQL database."
while ! PGPASSWORD='docker' psql -h postgres -U docker -p 5432 -l &> /dev/null
do
printf "🐘"
Expand All @@ -29,6 +29,26 @@ pushd /root/QGIS > /dev/null
/root/QGIS/tests/testdata/provider/testdata_pg.sh
popd > /dev/null # /root/QGIS

##############################
# Restore Oracle test data
##############################

export ORACLE_HOST="oracle"
export QGIS_ORACLETEST_DBNAME="${ORACLE_HOST}/XEPDB1"
export QGIS_ORACLETEST_DB="host=${QGIS_ORACLETEST_DBNAME} port=1521 user='QGIS' password='qgis'"

echo "Wait a moment while loading Oracle database."
while ! echo exit | sqlplus -L SYSTEM/adminpass@$QGIS_ORACLETEST_DBNAME &> /dev/null
do
printf "."
sleep 1
done
echo " done"

pushd /root/QGIS > /dev/null
/root/QGIS/tests/testdata/provider/testdata_oracle.sh $ORACLE_HOST
popd > /dev/null # /root/QGIS

# this is proving very flaky:

##############################
Expand Down Expand Up @@ -81,6 +101,3 @@ if [ $rv -eq 124 ] ; then
printf '\n\n${bold}Build and test timeout. Please restart the build for meaningful results.${endbold}\n'
exit #$rv
fi



13 changes: 13 additions & 0 deletions .docker/qgis3-build-deps-disco.dockerfile
Expand Up @@ -25,6 +25,7 @@ RUN apt-get update \
git \
graphviz \
grass-dev \
libaio1 \
libexiv2-dev \
libexpat1-dev \
libfcgi-dev \
Expand Down Expand Up @@ -96,6 +97,7 @@ RUN apt-get update \
saga \
spawn-fcgi \
txt2tags \
unzip \
xauth \
xfonts-100dpi \
xfonts-75dpi \
Expand All @@ -115,6 +117,17 @@ RUN apt-get update \
pyopenssl \
&& apt-get clean

# Oracle : client side
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-basic-linux.x64-19.3.0.0.0dbru.zip > instantclient-basic-linux.x64-19.3.0.0.0dbru.zip
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip > instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip > instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip

RUN unzip instantclient-basic-linux.x64-19.3.0.0.0dbru.zip
RUN unzip instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip
RUN unzip instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip

ENV PATH="/instantclient_19_3:${PATH}"
ENV LD_LIBRARY_PATH="/instantclient_19_3:${LD_LIBRARY_PATH}"

# MSSQL: client side
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
Expand Down
14 changes: 13 additions & 1 deletion .docker/qgis3-build-deps.dockerfile
Expand Up @@ -26,6 +26,7 @@ RUN apt-get update \
git \
graphviz \
grass-dev \
libaio1 \
libexiv2-dev \
libexpat1-dev \
libfcgi-dev \
Expand Down Expand Up @@ -98,6 +99,7 @@ RUN apt-get update \
saga \
spawn-fcgi \
txt2tags \
unzip \
xauth \
xfonts-100dpi \
xfonts-75dpi \
Expand Down Expand Up @@ -128,6 +130,17 @@ RUN apt-get update \
six \
&& apt-get clean

# Oracle : client side
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-basic-linux.x64-19.3.0.0.0dbru.zip > instantclient-basic-linux.x64-19.3.0.0.0dbru.zip
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip > instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip
RUN curl https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip > instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip

RUN unzip instantclient-basic-linux.x64-19.3.0.0.0dbru.zip
RUN unzip instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip
RUN unzip instantclient-sqlplus-linux.x64-19.3.0.0.0dbru.zip

ENV PATH="/instantclient_19_3:${PATH}"
ENV LD_LIBRARY_PATH="/instantclient_19_3:${LD_LIBRARY_PATH}"

# MSSQL: client side
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
Expand Down Expand Up @@ -158,4 +171,3 @@ RUN curl -k https://downloads.kdab.com/clazy/1.6/Clazy-x86_64-1.6.AppImage -o /t
ENV QT_SELECT=5
ENV LANG=C.UTF-8
ENV PATH="/usr/local/bin:${PATH}"

4 changes: 2 additions & 2 deletions tests/src/python/test_provider_oracle.py
Expand Up @@ -40,7 +40,7 @@ class TestPyQgsOracleProvider(unittest.TestCase, ProviderTestCase):
@classmethod
def setUpClass(cls):
"""Run before all tests"""
cls.dbconn = "host=localhost port=1521 user='QGIS' password='qgis'"
cls.dbconn = "host=localhost/XEPDB1 port=1521 user='QGIS' password='qgis'"
if 'QGIS_ORACLETEST_DB' in os.environ:
cls.dbconn = os.environ['QGIS_ORACLETEST_DB']
# Create test layers
Expand All @@ -54,7 +54,7 @@ def setUpClass(cls):
cls.poly_provider = cls.poly_vl.dataProvider()

cls.conn = QSqlDatabase.addDatabase('QOCISPATIAL', "oracletest")
cls.conn.setDatabaseName('10.0.0.2/orcl')
cls.conn.setDatabaseName('localhost/XEPDB1')
if 'QGIS_ORACLETEST_DBNAME' in os.environ:
cls.conn.setDatabaseName(os.environ['QGIS_ORACLETEST_DBNAME'])
cls.conn.setUserName('QGIS')
Expand Down
12 changes: 12 additions & 0 deletions tests/testdata/provider/testdata_oracle.sh
@@ -0,0 +1,12 @@
#!/bin/sh

HOST=$1

set -e

echo "create user QGIS identified by qgis;
grant create session to qgis;
grant all privileges to qgis;
exit" | sqlplus SYSTEM/adminpass@$HOST/XEPDB1

echo exit | sqlplus QGIS/qgis@$HOST/XEPDB1 @tests/testdata/provider/testdata_oracle.sql

0 comments on commit e5fd756

Please sign in to comment.