Modified tests and setup to run AE tests in Azure

This commit is contained in:
Jenny Tam 2018-01-31 08:27:06 -08:00
parent 3bc2c74fd3
commit 907e8c8e5c
5 changed files with 31 additions and 11 deletions

View file

@ -16,10 +16,18 @@
function IsAEQualified($conn)
{
$msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"];
$server_ver = $conn->getAttribute(PDO::ATTR_SERVER_VERSION);
$msodbcsql_maj = explode(".", $msodbcsql_ver)[0];
$msodbcsql_min = explode(".", $msodbcsql_ver)[1];
if ($msodbcsql_maj < 17 || explode('.', $server_ver)[0] < 13)
if ($msodbcsql_maj < 17) {
return false;
}
require 'MsSetup.inc';
if ($daasMode) {
// running against Azure
return true;
}
// if not Azure, check the server version
$server_ver = $conn->getAttribute(PDO::ATTR_SERVER_VERSION);
if (explode('.', $server_ver)[0] < 13)
return false;
return true;
}

View file

@ -20,11 +20,19 @@ const KSP_TEST_TABLE = 'CustomKSPTestTable';
function isAEQualified($conn)
{
$msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"];
$server_ver = $conn->getAttribute(PDO::ATTR_SERVER_VERSION);
$msodbcsql_maj = explode(".", $msodbcsql_ver)[0];
if ($msodbcsql_maj < 17 || explode('.', $server_ver)[0] < 13) {
if ($msodbcsql_maj < 17) {
return false;
}
require 'MsSetup.inc';
if ($daasMode) {
// running against Azure
return true;
}
// if not Azure, check the server version
$server_ver = $conn->getAttribute(PDO::ATTR_SERVER_VERSION);
if (explode('.', $server_ver)[0] < 13)
return false;
return true;
}

View file

@ -1,6 +1,3 @@
USE $(dbname)
GO
/* DROP Column Encryption Key first, Column Master Key cannot be dropped until no encryption depends on it */
IF EXISTS (SELECT * FROM sys.column_encryption_keys WHERE [name] LIKE '%AEColumnKey%')

View file

@ -45,13 +45,14 @@ def executeBulkCopy(conn_options, dbname, tblname, datafile):
inst_command = redirect_string.format(dbname, tblname, datafile) + conn_options
executeCommmand(inst_command)
def setupAE( conn_options, dbname, azure ):
if (platform.system() == 'Windows' and azure.lower() == 'no'):
def setupAE(conn_options, dbname):
if (platform.system() == 'Windows'):
# import self signed certificate
inst_command = "certutil -user -p '' -importPFX My PHPcert.pfx NoRoot"
executeCommmand(inst_command)
# create Column Master Key and Column Encryption Key
executeSQLscript('ae_keys.sql', conn_options, dbname)
script_command = 'sqlcmd ' + conn_options + ' -i ae_keys.sql -d ' + dbname
executeCommmand(script_command)
if __name__ == '__main__':
parser = argparse.ArgumentParser()

View file

@ -353,6 +353,12 @@ function isQualified($conn)
if (explode(".", $msodbcsql_ver)[0] < 17) {
return false;
}
global $daasMode;
if ($daasMode) {
// running against Azure
return true;
}
// if not Azure, check the server version
$server_ver = sqlsrv_server_info($conn)['SQLServerVersion'];
if (explode('.', $server_ver)[0] < 13) {
return false;