Merge pull request #677 from yitam/Azure
Modified tests and setup to run AE tests in Azure
This commit is contained in:
commit
21aa879d38
|
@ -16,10 +16,18 @@
|
||||||
function IsAEQualified($conn)
|
function IsAEQualified($conn)
|
||||||
{
|
{
|
||||||
$msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"];
|
$msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"];
|
||||||
$server_ver = $conn->getAttribute(PDO::ATTR_SERVER_VERSION);
|
|
||||||
$msodbcsql_maj = explode(".", $msodbcsql_ver)[0];
|
$msodbcsql_maj = explode(".", $msodbcsql_ver)[0];
|
||||||
$msodbcsql_min = explode(".", $msodbcsql_ver)[1];
|
if ($msodbcsql_maj < 17) {
|
||||||
if ($msodbcsql_maj < 17 || explode('.', $server_ver)[0] < 13)
|
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 false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,19 @@ const KSP_TEST_TABLE = 'CustomKSPTestTable';
|
||||||
function isAEQualified($conn)
|
function isAEQualified($conn)
|
||||||
{
|
{
|
||||||
$msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"];
|
$msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"];
|
||||||
$server_ver = $conn->getAttribute(PDO::ATTR_SERVER_VERSION);
|
|
||||||
$msodbcsql_maj = explode(".", $msodbcsql_ver)[0];
|
$msodbcsql_maj = explode(".", $msodbcsql_ver)[0];
|
||||||
if ($msodbcsql_maj < 17 || explode('.', $server_ver)[0] < 13) {
|
if ($msodbcsql_maj < 17) {
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
USE $(dbname)
|
|
||||||
GO
|
|
||||||
|
|
||||||
/* DROP Column Encryption Key first, Column Master Key cannot be dropped until no encryption depends on it */
|
/* 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%')
|
IF EXISTS (SELECT * FROM sys.column_encryption_keys WHERE [name] LIKE '%AEColumnKey%')
|
||||||
|
|
||||||
|
|
|
@ -45,13 +45,14 @@ def executeBulkCopy(conn_options, dbname, tblname, datafile):
|
||||||
inst_command = redirect_string.format(dbname, tblname, datafile) + conn_options
|
inst_command = redirect_string.format(dbname, tblname, datafile) + conn_options
|
||||||
executeCommmand(inst_command)
|
executeCommmand(inst_command)
|
||||||
|
|
||||||
def setupAE( conn_options, dbname, azure ):
|
def setupAE(conn_options, dbname):
|
||||||
if (platform.system() == 'Windows' and azure.lower() == 'no'):
|
if (platform.system() == 'Windows'):
|
||||||
# import self signed certificate
|
# import self signed certificate
|
||||||
inst_command = "certutil -user -p '' -importPFX My PHPcert.pfx NoRoot"
|
inst_command = "certutil -user -p '' -importPFX My PHPcert.pfx NoRoot"
|
||||||
executeCommmand(inst_command)
|
executeCommmand(inst_command)
|
||||||
# create Column Master Key and Column Encryption Key
|
# 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__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
@ -84,7 +85,7 @@ if __name__ == '__main__':
|
||||||
# populate these tables
|
# populate these tables
|
||||||
populateTables(conn_options, args.DBNAME)
|
populateTables(conn_options, args.DBNAME)
|
||||||
# setup AE (certificate, column master key and column encryption key)
|
# setup AE (certificate, column master key and column encryption key)
|
||||||
setupAE(conn_options, args.DBNAME, args.AZURE)
|
setupAE(conn_options, args.DBNAME)
|
||||||
|
|
||||||
os.chdir(current_working_dir)
|
os.chdir(current_working_dir)
|
||||||
|
|
||||||
|
|
|
@ -353,6 +353,12 @@ function isQualified($conn)
|
||||||
if (explode(".", $msodbcsql_ver)[0] < 17) {
|
if (explode(".", $msodbcsql_ver)[0] < 17) {
|
||||||
return false;
|
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'];
|
$server_ver = sqlsrv_server_info($conn)['SQLServerVersion'];
|
||||||
if (explode('.', $server_ver)[0] < 13) {
|
if (explode('.', $server_ver)[0] < 13) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue