Add MSSQL setup to Azure Pipelines build

This commit is contained in:
Adam Baratz 2021-01-11 21:46:41 -05:00
parent 65c789148b
commit b569698095
13 changed files with 38 additions and 4 deletions

View File

@ -40,6 +40,7 @@ steps:
postgresql-contrib \
snmpd \
snmp-mibs-downloader \
freetds-dev \
unixodbc-dev \
llvm \
libc-client-dev \

View File

@ -63,6 +63,7 @@ steps:
--with-imap-ssl \
--with-pdo-odbc=unixODBC,/usr \
--with-pdo-firebird \
--with-pdo-dblib \
--enable-werror \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d

View File

@ -10,6 +10,7 @@ jobs:
pool:
vmImage: 'ubuntu-18.04'
steps:
- template: mssql.yml
- template: apt.yml
- script: |
sudo -H pip install gcovr

View File

@ -10,6 +10,7 @@ jobs:
pool:
vmImage: 'ubuntu-18.04'
steps:
- template: mssql.yml
- template: apt.yml
- template: configure.yml
parameters:

View File

@ -10,6 +10,7 @@ jobs:
pool:
vmImage: 'ubuntu-20.04'
steps:
- template: mssql.yml
- template: apt.yml
- template: configure.yml
parameters:

5
azure/mssql.yml Normal file
View File

@ -0,0 +1,5 @@
# this template should be included close to the beginning, before setup.yml
# the container needs time to come up or the sqlcmd operation in setup.yml will have a login timeout
steps:
- script: docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong@Passw0rd>" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2019-CU8-ubuntu-16.04
displayName: 'Start MSSQL container'

View File

@ -7,6 +7,7 @@ steps:
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
sudo -u postgres psql -c "CREATE DATABASE test;"
docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "<YourStrong@Passw0rd>" -Q "create login pdo_test with password='password', check_policy=off; create user pdo_test for login pdo_test; grant alter, control to pdo_test;"
displayName: 'Setup'
- script: ./azure/setup-slapd.sh
displayName: 'Configure slapd'

View File

@ -9,6 +9,9 @@ steps:
export PDO_MYSQL_TEST_DSN="mysql:host=localhost;dbname=test"
export PDO_MYSQL_TEST_USER=root
export PDO_MYSQL_TEST_PASS=root
export PDO_DBLIB_TEST_DSN="dblib:host=127.0.0.1;dbname=master;version=7.0"
export PDO_DBLIB_TEST_USER="pdo_test"
export PDO_DBLIB_TEST_PASS="password"
export TEST_PHP_JUNIT=junit.xml
export REPORT_EXIT_STATUS=no
export SKIP_IO_CAPTURE_TESTS=1

View File

@ -15,7 +15,16 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$db->exec('CREATE TABLE test(id INT)');
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
case 'dblib':
$sql = 'CREATE TABLE test(id INT NULL)';
break;
default:
$sql = 'CREATE TABLE test(id INT)';
break;
}
$db->exec($sql);
$stmt = $db->prepare('INSERT INTO test VALUES(:value)');

View File

@ -0,0 +1,11 @@
# The pdo_mysql extension tests
This extension can be tested using Microsoft's Docker image for [SQL Server on Linux](https://hub.docker.com/_/microsoft-mssql-server):
```bash
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong@Passw0rd>" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2019-latest
docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "<YourStrong@Passw0rd>" -Q "create login pdo_test with password='password', check_policy=off; create user pdo_test for login pdo_test; grant alter, control to pdo_test;"
# and then from the root of php-src
PDO_DBLIB_TEST_DSN="dblib:host=127.0.0.1;dbname=master;version=7.0" PDO_DBLIB_TEST_USER="pdo_test" PDO_DBLIB_TEST_PASS="password" TESTS=ext/pdo_dblib make test
```

View File

@ -31,7 +31,7 @@ array(10) {
["native_usertype_id"]=>
int(%d)
["pdo_type"]=>
int(2)
int(3)
["name"]=>
string(13) "TABLE_CATALOG"
["len"]=>

View File

@ -23,5 +23,5 @@ Key: Name: [6] :value
paramno=-1
name=[6] ":value"
is_param=1
param_type=1073741826
param_type=1073741827
NULL

View File

@ -77,6 +77,6 @@ string(19) "2030-01-01 23:59:59"
string(1) "0"
bool(true)
string(4) "1000"
string(5) "10.50"
string(7) "10.5000"
string(19) "1950-01-18 23:00:00"
string(1) "1"