Skip to content

Commit bdf2e4a

Browse files
committed
Run PostGis20 unit tests on Ubuntu
1 parent a765e6d commit bdf2e4a

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

Tests.NHibernate.Spatial.MsSql2008/MsSql2008NtsTestCasesFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ protected override void Configure(Configuration configuration)
1717
TestConfiguration.Configure(configuration);
1818
}
1919

20-
private const string LocalDataPath = @"..\..\..\..\Tests.NHibernate.Spatial.MsSql2008\NtsTestCases\Data\vivid";
20+
private const string LocalDataPath = @"../../../../Tests.NHibernate.Spatial.MsSql2008/NtsTestCases/Data/vivid";
2121

2222
protected override string TestSimpleDataPath
2323
{

Tests.NHibernate.Spatial.MsSql2012/MsSql2012NtsTestCasesFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ protected override void Configure(Configuration configuration)
1212
TestConfiguration.Configure(configuration);
1313
}
1414

15-
private const string LocalDataPath = @"..\..\..\..\Tests.NHibernate.Spatial.MsSql2012\NtsTestCases\Data\vivid";
15+
private const string LocalDataPath = @"../../../../Tests.NHibernate.Spatial.MsSql2012/NtsTestCases/Data/vivid";
1616

1717
protected override string TestRelateAADataPath
1818
{

Tests.NHibernate.Spatial/NtsTestCases/NtsTestCasesFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Tests.NHibernate.Spatial.NtsTestCases
1717
/// </summary>
1818
public abstract class NtsTestCasesFixture : AbstractFixture
1919
{
20-
private const string DataPath = @"..\..\..\..\Tests.NHibernate.Spatial\NtsTestCases\Data\vivid";
20+
private const string DataPath = @"../../../../Tests.NHibernate.Spatial/NtsTestCases/Data/vivid";
2121

2222
protected override Type[] Mappings
2323
{

appveyor.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ image:
77
- Visual Studio 2017
88
- Ubuntu
99

10-
# disable execution of PowerShell commands on Linux
11-
environment:
12-
APPVEYOR_YML_DISABLE_PS_LINUX: true
13-
1410
# scripts that run after cloning repository
1511
install:
1612
# install SQL Server 2008 R2 SP2 Express (not included in VS 2017 image; see: https://www.appveyor.com/docs/build-environment/#databases)
@@ -26,19 +22,19 @@ install:
2622
- cmd: SQLSysClrTypes.msi /passive
2723

2824
# enable dynamic TCP ports for 2008 and 2012 SQL Server instances (so they can be run simultaneously)
29-
- ps: set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql10_50.SQL2008R2SP2\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpDynamicPorts -value '0'
30-
- ps: set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql10_50.SQL2008R2SP2\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpPort -value ''
31-
- ps: set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql11.SQL2012SP1\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpDynamicPorts -value '0'
32-
- ps: set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql11.SQL2012SP1\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpPort -value ''
25+
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql10_50.SQL2008R2SP2\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpDynamicPorts -value '0' }
26+
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql10_50.SQL2008R2SP2\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpPort -value '' }
27+
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql11.SQL2012SP1\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpDynamicPorts -value '0' }
28+
- ps: if ($isWindows) { set-itemproperty -path 'HKLM:\software\microsoft\microsoft sql server\mssql11.SQL2012SP1\mssqlserver\supersocketnetlib\tcp\ipall' -name TcpPort -value '' }
3329

3430
# install MySQL 5.6
3531
# - cmd: curl -L -O -S -s https://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-web-community-5.6.36.0.msi
3632
# - cmd: msiexec /i mysql-installer-web-community-5.6.36.0.msi /quiet
3733
# - cmd: "C:\Program Files (x86)\MySQL\MySQL Installer for Windows\MySQLInstallerConsole.exe" community install server;5.6.36;x64:*:port=3306;passwd=Password12! -silent
3834

3935
# change default port for MySQL 5.7 (so it can run simultaneously with MySQL 5.6)
40-
# - ps: $iniPath = 'C:\ProgramData\MySQL\MySQL Server 5.7\my.ini'
41-
# - ps: (Get-Content $iniPath).replace('port=3306', 'port=3307') | Set-Content $iniPath
36+
# - ps: if ($isWindows) { $iniPath = 'C:\ProgramData\MySQL\MySQL Server 5.7\my.ini' }
37+
# - ps: if ($isWindows) { (Get-Content $iniPath).replace('port=3306', 'port=3307') | Set-Content $iniPath }
4238

4339
# install PostgreSQL 8.4
4440
- cmd: curl -L -O -S -s https://get.enterprisedb.com/postgresql/postgresql-8.4.22-1-windows.exe
@@ -55,11 +51,18 @@ install:
5551
- cmd: psql -q -p 5431 -U postgres -d template_postgis -f "%PGDIR%\share\contrib\postgis-1.5\postgis.sql"
5652
- cmd: psql -q -p 5431 -U postgres -d template_postgis -f "%PGDIR%\share\contrib\postgis-1.5\spatial_ref_sys.sql"
5753

58-
# install PostGIS 2.3.2 for PostgreSQL 9.6
54+
# install PostGIS 2.3.2 for PostgreSQL 9.6 on Windows
5955
- cmd: curl -L -O -S -s http://download.osgeo.org/postgis/windows/pg96/archive/postgis-bundle-pg96-2.3.2x64.zip
6056
- cmd: 7z x postgis-bundle-pg96-2.3.2x64.zip > nul
6157
- cmd: xcopy /s /y /q postgis-bundle-pg96-2.3.2x64 "C:\Program Files\PostgreSQL\9.6"
6258

59+
# install PostgreSQL 9.6 and PostGIS 2.3 on Ubuntu
60+
- sh: sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main"
61+
- sh: wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
62+
- sh: sudo apt-get update
63+
- sh: sudo apt-get -y install postgresql-9.6 postgresql-9.6-postgis-2.3
64+
- sh: sudo sed -i 's/port = [0-9]\+/port = 5432/' /etc/postgresql/9.6/main/postgresql.conf
65+
6366
# start services required for build/tests
6467
# NOTE: Services are now started in "before_test" section as services are not available on Ubuntu image
6568
# services:
@@ -112,26 +115,31 @@ before_test:
112115
- cmd: SET psql="C:\Program Files (x86)\PostgreSQL\8.4\bin\psql.exe"
113116
- cmd: '%psql% -q -p 5431 -U postgres -f Tests.NHibernate.Spatial.PostGis\nhsp_test.sql'
114117

115-
# setup PostgreSQL 9.6
118+
# setup PostgreSQL 9.6 on Windows
116119
- cmd: net start postgresql-x64-9.6
117120
- cmd: SET psql="C:\Program Files\PostgreSQL\9.6\bin\psql.exe"
118121
- cmd: '%psql% -q -p 5432 -U postgres -f Tests.NHibernate.Spatial.PostGis20\nhsp_test.sql'
119122

123+
# setup PostgreSQL 9.6 on Ubuntu
124+
# NOTE: Need to run psql command as postgres user to prevent peer authentication failure
125+
- sh: sudo pg_ctlcluster 9.6 main start
126+
- sh: sudo -u postgres psql -q -p 5432 -U postgres -f Tests.NHibernate.Spatial.PostGis20/nhsp_test.sql
127+
120128
test_script:
121129
- cmd: dotnet test -c Release --no-build --logger "trx;LogFileName=MsSql2008.trx" --results-directory %APPVEYOR_BUILD_FOLDER% Tests.NHibernate.Spatial.MsSql2008
122130
- cmd: dotnet test -c Release --no-build --logger "trx;LogFileName=MsSql2012.trx" --results-directory %APPVEYOR_BUILD_FOLDER% Tests.NHibernate.Spatial.MsSql2012
123131
# Disable MySQL tests until issue #87 is resolved
124132
# - cmd: dotnet test -c Release --no-build --logger "trx;LogFileName=MySQL.trx" --results-directory %APPVEYOR_BUILD_FOLDER% Tests.NHibernate.Spatial.MySQL
125133
# - cmd: dotnet test -c Release --no-build --logger "trx;LogFileName=MySQL57.trx" --results-directory %APPVEYOR_BUILD_FOLDER% Tests.NHibernate.Spatial.MySQL57
126134
- cmd: dotnet test -c Release --no-build --logger "trx;LogFileName=PostGis.trx" --results-directory %APPVEYOR_BUILD_FOLDER% Tests.NHibernate.Spatial.PostGis
127-
- cmd: dotnet test -c Release --no-build --logger "trx;LogFileName=PostGis20.trx" --results-directory %APPVEYOR_BUILD_FOLDER% Tests.NHibernate.Spatial.PostGis20
135+
- ps: dotnet test -c Release --no-build --logger "trx;LogFileName=PostGis20.trx" --results-directory $env:APPVEYOR_BUILD_FOLDER Tests.NHibernate.Spatial.PostGis20
128136

129137
after_test:
130138
- ps: $wc = New-Object 'System.Net.WebClient'
131139
- ps: $uri = "https://ci.appveyor.com/api/testresults/mstest/$($env:APPVEYOR_JOB_ID)"
132-
- ps: $wc.UploadFile($uri, (Resolve-Path MsSql2008.trx))
133-
- ps: $wc.UploadFile($uri, (Resolve-Path MsSql2012.trx))
140+
- ps: if ($isWindows) { $wc.UploadFile($uri, (Resolve-Path MsSql2008.trx)) }
141+
- ps: if ($isWindows) { $wc.UploadFile($uri, (Resolve-Path MsSql2012.trx)) }
134142
# - ps: $wc.UploadFile($uri, (Resolve-Path MySQL.trx))
135143
# - ps: $wc.UploadFile($uri, (Resolve-Path MySQL57.trx))
136-
- ps: $wc.UploadFile($uri, (Resolve-Path PostGis.trx))
144+
- ps: if ($isWindows) { $wc.UploadFile($uri, (Resolve-Path PostGis.trx)) }
137145
- ps: $wc.UploadFile($uri, (Resolve-Path PostGis20.trx))

0 commit comments

Comments
 (0)