mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-19 00:04:52 -04:00
SQL Server on Travis
This commit is contained in:
parent
a1a35e91cc
commit
c6dda7b4f3
@ -47,6 +47,7 @@ cmake \
|
||||
-DSUPPRESS_QT_WARNINGS=ON \
|
||||
-DENABLE_MODELTEST=ON \
|
||||
-DENABLE_PGTEST=ON \
|
||||
-DENABLE_MSSQLTEST=ON \
|
||||
-DWITH_QSPATIALITE=ON \
|
||||
-DWITH_QWTPOLAR=OFF \
|
||||
-DWITH_APIDOC=OFF \
|
||||
@ -107,6 +108,36 @@ pushd /root/QGIS > /dev/null
|
||||
/root/QGIS/tests/testdata/provider/testdata_pg.sh
|
||||
popd > /dev/null # /root/QGIS
|
||||
|
||||
##############################
|
||||
# Restore SQL Server test data
|
||||
##############################
|
||||
|
||||
echo "Importing SQL Server test data..."
|
||||
|
||||
export SQLUSER=sa
|
||||
export SQLHOST=mssql
|
||||
export SQLPORT=1433
|
||||
export SQLPASSWORD='<YourStrong!Passw0rd>'
|
||||
export SQLDATABASE=qgis_test
|
||||
|
||||
export PATH=$PATH:/opt/mssql-tools/bin
|
||||
|
||||
pushd /root/QGIS > /dev/null
|
||||
/root/QGIS/tests/testdata/provider/testdata_mssql.sh
|
||||
popd > /dev/null # /root/QGIS
|
||||
|
||||
echo "Setting up DSN for test SQL Server"
|
||||
|
||||
cat <<EOT > /etc/odbc.ini
|
||||
[ODBC Data Sources]
|
||||
testsqlserver = ODBC Driver 17 for SQL Server
|
||||
|
||||
[testsqlserver]
|
||||
Driver = ODBC Driver 17 for SQL Server
|
||||
Description = Test SQL Server
|
||||
Server = mssql
|
||||
EOT
|
||||
|
||||
###########
|
||||
# Run tests
|
||||
###########
|
||||
|
@ -5,6 +5,12 @@ services:
|
||||
environment:
|
||||
- ALLOW_IP_RANGE="172.18.0.0/16"
|
||||
|
||||
mssql:
|
||||
image: microsoft/mssql-server-linux:2017-latest
|
||||
environment:
|
||||
ACCEPT_EULA: Y
|
||||
SA_PASSWORD: <YourStrong!Passw0rd>
|
||||
|
||||
qgis-deps:
|
||||
tty: true
|
||||
image: qgis/qgis3-build-deps:${DOCKER_TAG}
|
||||
@ -13,6 +19,7 @@ services:
|
||||
- $HOME/.ccache:/root/.ccache # if changed, also change env var
|
||||
links:
|
||||
- postgres
|
||||
- mssql
|
||||
environment:
|
||||
- CCACHE_DIR=/root/.ccache
|
||||
- CTEST_BUILD_DIR=/root/QGIS
|
||||
|
@ -7,10 +7,12 @@ LABEL Description="Docker container with QGIS dependencies" Vendor="QGIS.org" Ve
|
||||
# && echo "deb-src http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main" >> /etc/apt/sources.list \
|
||||
# && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 314DF160 \
|
||||
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y software-properties-common \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y \
|
||||
apt-transport-https \
|
||||
bison \
|
||||
ca-certificates \
|
||||
ccache \
|
||||
@ -40,6 +42,7 @@ RUN apt-get update \
|
||||
libqt5quick5 \
|
||||
libqt5quickcontrols2-5 \
|
||||
libqt5scintilla2-dev \
|
||||
libqt5sql5-odbc \
|
||||
libqt5sql5-sqlite \
|
||||
libqt5svg5-dev \
|
||||
libqt5webkit5-dev \
|
||||
@ -112,6 +115,19 @@ RUN apt-get update \
|
||||
pyopenssl \
|
||||
&& apt-get clean
|
||||
|
||||
|
||||
# MSSQL: client side
|
||||
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
|
||||
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/msprod.list
|
||||
RUN apt-get update
|
||||
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17 mssql-tools
|
||||
|
||||
# Avoid sqlcmd termination due to locale -- see https://github.com/Microsoft/mssql-docker/issues/163
|
||||
RUN echo "nb_NO.UTF-8 UTF-8" > /etc/locale.gen
|
||||
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
|
||||
RUN locale-gen
|
||||
|
||||
|
||||
RUN echo "alias python=python3" >> ~/.bash_aliases
|
||||
|
||||
ENV CC=/usr/lib/ccache/clang
|
||||
|
@ -30,7 +30,6 @@ from qgis.core import (QgsSettings,
|
||||
QgsCoordinateReferenceSystem)
|
||||
|
||||
from qgis.PyQt.QtCore import QDate, QTime, QDateTime, QVariant
|
||||
|
||||
from utilities import unitTestDataPath
|
||||
from qgis.testing import start_app, unittest
|
||||
from providertestbase import ProviderTestCase
|
||||
@ -44,18 +43,18 @@ class TestPyQgsMssqlProvider(unittest.TestCase, ProviderTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Run before all tests"""
|
||||
cls.dbconn = "service='Driver={ODBC Driver 13 for SQL Server};server=127.0.0.1;uid=SA;pwd=<YourStrong!Passw0rd>' user='SA' password='<YourStrong!Passw0rd>'"
|
||||
|
||||
# These are the connection details for the SQL Server instance running on Travis
|
||||
cls.dbconn = "service='testsqlserver' user=sa password='<YourStrong!Passw0rd>' "
|
||||
if 'QGIS_MSSQLTEST_DB' in os.environ:
|
||||
cls.dbconn = os.environ['QGIS_MSSQLTEST_DB']
|
||||
# Create test layers
|
||||
cls.vl = QgsVectorLayer(
|
||||
cls.dbconn + ' sslmode=disable key=\'pk\' srid=4326 type=POINT table="qgis_test"."someData" (geom) sql=', 'test', 'mssql')
|
||||
assert(cls.vl.isValid())
|
||||
assert cls.vl.isValid(), cls.vl.dataProvider().error()
|
||||
cls.source = cls.vl.dataProvider()
|
||||
cls.poly_vl = QgsVectorLayer(
|
||||
cls.dbconn + ' sslmode=disable key=\'pk\' srid=4326 type=POLYGON table="qgis_test"."some_poly_data" (geom) sql=', 'test', 'mssql')
|
||||
assert(cls.poly_vl.isValid())
|
||||
assert cls.poly_vl.isValid(), cls.poly_vl.dataProvider().error()
|
||||
cls.poly_provider = cls.poly_vl.dataProvider()
|
||||
|
||||
@classmethod
|
||||
|
Loading…
x
Reference in New Issue
Block a user