Updated tests to run against AE v2 server (#1305)
This commit is contained in:
parent
48b6a6013f
commit
c87af63d57
|
@ -206,10 +206,12 @@ jobs:
|
||||||
coveralls -i ./source/ -e ./source/shared/ -e ./test/ -e ./source/pdo_sqlsrv/shared/core_stream.cpp \
|
coveralls -i ./source/ -e ./source/shared/ -e ./test/ -e ./source/pdo_sqlsrv/shared/core_stream.cpp \
|
||||||
-E r'.*localization*' -E r'.*globalization*' --gcov-options '\-lp'
|
-E r'.*localization*' -E r'.*globalization*' --gcov-options '\-lp'
|
||||||
displayName: 'Invoke coveralls using repo token'
|
displayName: 'Invoke coveralls using repo token'
|
||||||
|
condition: false
|
||||||
env:
|
env:
|
||||||
COVERALLS_REPO_TOKEN: $(repo_token)
|
COVERALLS_REPO_TOKEN: $(repo_token)
|
||||||
TRAVIS_JOB_ID: $(Build.BuildId)
|
TRAVIS_JOB_ID: $(Build.BuildId)
|
||||||
TRAVIS_BRANCH: $(Build.SourceBranchName)
|
TRAVIS_BRANCH: $(Build.SourceBranchName)
|
||||||
|
PYTHONWARNINGS: ignore::yaml.YAMLLoadWarning
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
cd $(Build.SourcesDirectory)/test/functional/
|
cd $(Build.SourcesDirectory)/test/functional/
|
||||||
|
|
|
@ -636,6 +636,25 @@ function IsDaasMode()
|
||||||
return ($daasMode ? true : false);
|
return ($daasMode ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isServerHGSEnabled()
|
||||||
|
{
|
||||||
|
$enabled = false;
|
||||||
|
try {
|
||||||
|
$conn = connect();
|
||||||
|
$tsql = "SELECT @@SERVERNAME";
|
||||||
|
$stmt = $conn->query($tsql);
|
||||||
|
|
||||||
|
$result = $stmt->fetch(PDO::FETCH_NUM);
|
||||||
|
$name = $result[0];
|
||||||
|
|
||||||
|
$enabled = (strpos($result[0], 'HGS') != false);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
die("Could not fetch server property.");
|
||||||
|
}
|
||||||
|
return $enabled;
|
||||||
|
}
|
||||||
|
|
||||||
function isSQLAzure()
|
function isSQLAzure()
|
||||||
{
|
{
|
||||||
// 'SQL Azure' indicates SQL Database or SQL Data Warehouse
|
// 'SQL Azure' indicates SQL Database or SQL Data Warehouse
|
||||||
|
|
|
@ -3,7 +3,7 @@ Test some basics of Azure AD Access Token support
|
||||||
--DESCRIPTION--
|
--DESCRIPTION--
|
||||||
This test also expects certain exceptions to be thrown under some conditions.
|
This test also expects certain exceptions to be thrown under some conditions.
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php require('skipif.inc');
|
<?php require('skipif_azure.inc');
|
||||||
require('skipif_azure_ad_acess_token.inc'); ?>
|
require('skipif_azure_ad_acess_token.inc'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -8,21 +8,17 @@ the error message of one test case is not the same.
|
||||||
<?php require('skipif_mid-refactor.inc'); ?>
|
<?php require('skipif_mid-refactor.inc'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("MsSetup.inc");
|
require_once('MsSetup.inc');
|
||||||
|
require_once('MsCommon_mid-refactor.inc');
|
||||||
|
|
||||||
$msodbcsqlMaj = "";
|
$msodbcsqlMaj = "";
|
||||||
$hgsEnabled = true;
|
$hgsEnabled = isServerHGSEnabled();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$conn = new PDO("sqlsrv:server = $server", $uid, $pwd);
|
$conn = new PDO("sqlsrv:server = $server", $uid, $pwd);
|
||||||
$msodbcsqlVer = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)['DriverVer'];
|
$msodbcsqlVer = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)['DriverVer'];
|
||||||
$version = explode(".", $msodbcsqlVer);
|
$version = explode(".", $msodbcsqlVer);
|
||||||
$msodbcsqlMaj = $version[0];
|
$msodbcsqlMaj = $version[0];
|
||||||
|
|
||||||
// Next, check if the server is HGS enabled
|
|
||||||
$serverInfo = $conn->getAttribute(PDO::ATTR_SERVER_INFO);
|
|
||||||
if (strpos($serverInfo['SQLServerName'], 'PHPHGS') === false) {
|
|
||||||
$hgsEnabled = false;
|
|
||||||
}
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
echo "Failed to connect\n";
|
echo "Failed to connect\n";
|
||||||
print_r($e->getMessage());
|
print_r($e->getMessage());
|
||||||
|
@ -32,7 +28,6 @@ try {
|
||||||
testColumnEncryption($server, $uid, $pwd, $msodbcsqlMaj);
|
testColumnEncryption($server, $uid, $pwd, $msodbcsqlMaj);
|
||||||
echo "Done";
|
echo "Done";
|
||||||
|
|
||||||
|
|
||||||
function verifyOutput($PDOerror, $expected, $caseNum)
|
function verifyOutput($PDOerror, $expected, $caseNum)
|
||||||
{
|
{
|
||||||
if (strpos($PDOerror->getMessage(), $expected) === false) {
|
if (strpos($PDOerror->getMessage(), $expected) === false) {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Test PDO::__Construct by passing connection options and attributes.
|
Test PDO::__Construct by passing connection options and attributes.
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php require('skipif_mid-refactor.inc'); ?>
|
<?php require('skipif_azure.inc');
|
||||||
|
require('skipif_mid-refactor.inc'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("MsCommon_mid-refactor.inc");
|
require_once("MsCommon_mid-refactor.inc");
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Test PDO::__Construct by passing connection options
|
Test PDO::__Construct by passing connection options
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php require('skipif_mid-refactor.inc'); ?>
|
<?php require('skipif_azure.inc');
|
||||||
|
require('skipif_mid-refactor.inc'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("MsCommon_mid-refactor.inc");
|
require_once("MsCommon_mid-refactor.inc");
|
||||||
|
|
|
@ -6,3 +6,9 @@ require 'MsSetup.inc';
|
||||||
if ($daasMode) {
|
if ($daasMode) {
|
||||||
die("skip test not applicable in Azure\n");
|
die("skip test not applicable in Azure\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once('MsCommon_mid-refactor.inc');
|
||||||
|
if (isServerHGSEnabled()) {
|
||||||
|
die("skip test not applicable in Azure VM\n");
|
||||||
|
}
|
||||||
|
?>
|
|
@ -34,7 +34,7 @@ if ($msodbcsqlMin < 4 and $msodbcsqlMaj == 17) {
|
||||||
|
|
||||||
// Get SQL Server
|
// Get SQL Server
|
||||||
$serverInfo = $conn->getAttribute(PDO::ATTR_SERVER_INFO);
|
$serverInfo = $conn->getAttribute(PDO::ATTR_SERVER_INFO);
|
||||||
if (strpos($serverInfo['SQLServerName'], 'PHPHGS') === false) {
|
if (strpos($serverInfo['SQLServerName'], 'HGS') === false) {
|
||||||
die("skip Server is not HGS enabled");
|
die("skip Server is not HGS enabled");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -94,6 +94,21 @@ function isLocaleDisabled()
|
||||||
return ($daasMode || $localeDisabled);
|
return ($daasMode || $localeDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isServerHGSEnabled()
|
||||||
|
{
|
||||||
|
$conn = connect();
|
||||||
|
$tsql = "SELECT @@SERVERNAME";
|
||||||
|
$stmt = sqlsrv_query($conn, $tsql);
|
||||||
|
|
||||||
|
if (sqlsrv_fetch($stmt)) {
|
||||||
|
$name = sqlsrv_get_field($stmt, 0);
|
||||||
|
if (strpos($name, 'HGS') != false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function isSQLAzure()
|
function isSQLAzure()
|
||||||
{
|
{
|
||||||
// 'SQL Azure' indicates SQL Database or SQL Data Warehouse
|
// 'SQL Azure' indicates SQL Database or SQL Data Warehouse
|
||||||
|
|
|
@ -7,4 +7,8 @@ if (!extension_loaded("sqlsrv")) {
|
||||||
require 'MsSetup.inc';
|
require 'MsSetup.inc';
|
||||||
if ($daasMode) die("skip test not applicable in Azure\n");
|
if ($daasMode) die("skip test not applicable in Azure\n");
|
||||||
|
|
||||||
|
require 'MsCommon.inc';
|
||||||
|
if (isServerHGSEnabled()) {
|
||||||
|
die("skip test not applicable in Azure VM\n");
|
||||||
|
}
|
||||||
?>
|
?>
|
|
@ -34,7 +34,7 @@ if ($msodbcsql_min < 4 and $msodbcsql_maj == 17) {
|
||||||
|
|
||||||
// Get SQL Server
|
// Get SQL Server
|
||||||
$server_info = sqlsrv_server_info($conn);
|
$server_info = sqlsrv_server_info($conn);
|
||||||
if (strpos($server_info['SQLServerName'], 'PHPHGS') === false) {
|
if (strpos($server_info['SQLServerName'], 'HGS') === false) {
|
||||||
die("skip Server is not HGS enabled");
|
die("skip Server is not HGS enabled");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3,7 +3,7 @@ Test some basics of Azure AD Access Token support
|
||||||
--DESCRIPTION--
|
--DESCRIPTION--
|
||||||
This test also expects certain exceptions to be thrown under some conditions.
|
This test also expects certain exceptions to be thrown under some conditions.
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php require('skipif.inc');
|
<?php require('skipif_azure.inc');
|
||||||
require('skipif_azure_ad_acess_token.inc'); ?>
|
require('skipif_azure_ad_acess_token.inc'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -9,7 +9,7 @@ the error message of one test case is not the same.
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
sqlsrv_configure('WarningsReturnAsErrors', 0);
|
sqlsrv_configure('WarningsReturnAsErrors', 0);
|
||||||
require('MsSetup.inc');
|
require('MsCommon.inc');
|
||||||
|
|
||||||
$connectionOptions = array("Database"=>$database,"UID"=>$userName, "PWD"=>$userPassword);
|
$connectionOptions = array("Database"=>$database,"UID"=>$userName, "PWD"=>$userPassword);
|
||||||
testColumnEncryption($server, $connectionOptions);
|
testColumnEncryption($server, $connectionOptions);
|
||||||
|
@ -25,11 +25,7 @@ function testColumnEncryption($server, $connectionOptions)
|
||||||
$msodbcsqlMaj = explode(".", $msodbcsql_ver)[0];
|
$msodbcsqlMaj = explode(".", $msodbcsql_ver)[0];
|
||||||
|
|
||||||
// Next, check if the server is HGS enabled
|
// Next, check if the server is HGS enabled
|
||||||
$hgsEnabled = true;
|
$hgsEnabled = isServerHGSEnabled();
|
||||||
$serverInfo = sqlsrv_server_info($conn);
|
|
||||||
if (strpos($serverInfo['SQLServerName'], 'PHPHGS') === false) {
|
|
||||||
$hgsEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only works for ODBC 17
|
// Only works for ODBC 17
|
||||||
$connectionOptions['ColumnEncryption'] = 'Enabled';
|
$connectionOptions['ColumnEncryption'] = 'Enabled';
|
||||||
|
|
Loading…
Reference in a new issue