Skipped the non-applicables tests against Azure Data Warehouse (#913)
This commit is contained in:
parent
5801edd5c6
commit
25d6812087
|
@ -624,6 +624,33 @@ function IsDaasMode()
|
|||
return ($daasMode ? true : false);
|
||||
}
|
||||
|
||||
function isAzureDW()
|
||||
{
|
||||
// Check if running Azure Data Warehouse
|
||||
// For details, https://docs.microsoft.com/sql/t-sql/functions/serverproperty-transact-sql
|
||||
try {
|
||||
$conn = connect();
|
||||
|
||||
// Check if running Azure Data Warehouse
|
||||
// For details, https://docs.microsoft.com/sql/t-sql/functions/serverproperty-transact-sql
|
||||
$tsql = "SELECT SERVERPROPERTY ('edition'), SERVERPROPERTY ('EngineEdition')";
|
||||
$stmt = $conn->query($tsql);
|
||||
|
||||
$result = $stmt->fetch(PDO::FETCH_NUM);
|
||||
$edition = $result[0];
|
||||
$engEd = intval($result[1]);
|
||||
|
||||
if ($edition == "SQL Azure" && $engEd == 6) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
die("skip Failed to connect or could not fetch edition info.");
|
||||
}
|
||||
}
|
||||
|
||||
function FatalError($errorMsg)
|
||||
{
|
||||
if (!IsPdoMode()) {
|
||||
|
|
|
@ -6,7 +6,7 @@ emalloc (which only allocate memory in the memory space allocated for the PHP pr
|
|||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif_azure.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'MsCommon.inc';
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
Tests error returned when binding output parameter with emulate prepare
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif_mid-refactor.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("MsCommon_mid-refactor.inc");
|
||||
|
|
|
@ -6,6 +6,7 @@ Verifies the functionality of PDOStatement nextRowset
|
|||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif_mid-refactor.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
|
@ -12,30 +12,27 @@ require_once("MsSetup.inc");
|
|||
//
|
||||
$connectionInfo = "Database = $databaseName; Authentication = SqlPassword; TrustServerCertificate = true;";
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$conn = new PDO("sqlsrv:server = $server ; $connectionInfo", $uid, $pwd);
|
||||
echo "Connected successfully with Authentication=SqlPassword.\n";
|
||||
}
|
||||
catch( PDOException $e )
|
||||
{
|
||||
} catch (PDOException $e) {
|
||||
echo "Could not connect with Authentication=SqlPassword.\n";
|
||||
print_r($e->getMessage());
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
$stmt = $conn->query( "SELECT count(*) FROM cd_info" );
|
||||
if ( $stmt === false )
|
||||
{
|
||||
// For details, https://docs.microsoft.com/sql/t-sql/functions/serverproperty-transact-sql
|
||||
$conn->setAttribute(PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE, true);
|
||||
$stmt = $conn->query("SELECT SERVERPROPERTY('EngineEdition')");
|
||||
if ($stmt === false) {
|
||||
echo "Query failed.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $stmt->fetch();
|
||||
var_dump( $result );
|
||||
} else {
|
||||
$result = $stmt->fetch(PDO::FETCH_NUM);
|
||||
$edition = $result[0];
|
||||
var_dump($edition);
|
||||
}
|
||||
|
||||
$conn = null;
|
||||
unset($conn);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Test Azure AD with integrated authentication. This should fail because
|
||||
|
@ -43,14 +40,11 @@ $conn = null;
|
|||
//
|
||||
$connectionInfo = "Authentication = ActiveDirectoryIntegrated; TrustServerCertificate = true;";
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$conn = new PDO("sqlsrv:server = $server ; $connectionInfo");
|
||||
echo "Connected successfully with Authentication=ActiveDirectoryIntegrated.\n";
|
||||
$conn = null;
|
||||
}
|
||||
catch( PDOException $e )
|
||||
{
|
||||
unset($conn);
|
||||
} catch (PDOException $e) {
|
||||
echo "Could not connect with Authentication=ActiveDirectoryIntegrated.\n";
|
||||
print_r($e->getMessage());
|
||||
echo "\n";
|
||||
|
@ -65,35 +59,24 @@ $azureDatabase = $adDatabase;
|
|||
$azureUsername = $adUser;
|
||||
$azurePassword = $adPassword;
|
||||
|
||||
if ($azureServer != 'TARGET_AD_SERVER')
|
||||
{
|
||||
if ($azureServer != 'TARGET_AD_SERVER') {
|
||||
$connectionInfo = "Authentication = ActiveDirectoryPassword; TrustServerCertificate = false";
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$conn = new PDO("sqlsrv:server = $azureServer ; $connectionInfo", $azureUsername, $azurePassword);
|
||||
echo "Connected successfully with Authentication=ActiveDirectoryPassword.\n";
|
||||
}
|
||||
catch( PDOException $e )
|
||||
{
|
||||
} catch (PDOException $e) {
|
||||
echo "Could not connect with ActiveDirectoryPassword.\n";
|
||||
print_r($e->getMessage());
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "Not testing with Authentication=ActiveDirectoryPassword.\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Connected successfully with Authentication=SqlPassword.
|
||||
array(2) {
|
||||
[""]=>
|
||||
string(1) "7"
|
||||
[0]=>
|
||||
string(1) "7"
|
||||
}
|
||||
string(1) "%d"
|
||||
Could not connect with Authentication=ActiveDirectoryIntegrated.
|
||||
SQLSTATE[IMSSP]: Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
||||
%s with Authentication=ActiveDirectoryPassword.
|
||||
|
|
|
@ -4,6 +4,7 @@ Test PDO::prepare() with PDO::ATTR_EMULATE_PREPARES.
|
|||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif_mid-refactor.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
10
test/functional/pdo_sqlsrv/skipif_azure_dw.inc
Normal file
10
test/functional/pdo_sqlsrv/skipif_azure_dw.inc
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
if (!extension_loaded("pdo_sqlsrv")) {
|
||||
die("skip Extension not loaded");
|
||||
}
|
||||
|
||||
require_once('MsCommon_mid-refactor.inc');
|
||||
if (isAzureDW()) {
|
||||
die("skip test not applicable in Azure Data Warehouse\n");
|
||||
}
|
||||
?>
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
A test for a simple query
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure('WarningsReturnAsErrors', 0);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
zombied streams after sqlsrv_stmt_cancel.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
Test for integer, float, and datetime types vs various sql server types.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
|
@ -84,6 +84,28 @@ function isDaasMode()
|
|||
return ($daasMode ? true : false);
|
||||
}
|
||||
|
||||
function isAzureDW()
|
||||
{
|
||||
// Check if running Azure Data Warehouse
|
||||
// For details, https://docs.microsoft.com/sql/t-sql/functions/serverproperty-transact-sql
|
||||
$conn = connect();
|
||||
$tsql = "SELECT SERVERPROPERTY ('edition'), SERVERPROPERTY ('EngineEdition')";
|
||||
$stmt = sqlsrv_query($conn, $tsql);
|
||||
|
||||
if (sqlsrv_fetch($stmt)) {
|
||||
$edition = sqlsrv_get_field($stmt, 0);
|
||||
$engEd = sqlsrv_get_field($stmt, 1, SQLSRV_PHPTYPE_INT);
|
||||
|
||||
if ($edition == "SQL Azure" && $engEd == 6) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
die("Could not fetch edition info.");
|
||||
}
|
||||
}
|
||||
|
||||
function startTest($testName)
|
||||
{
|
||||
if (traceMode()) {
|
||||
|
|
|
@ -6,8 +6,8 @@ emalloc (which only allocate memory in the memory space allocated for the PHP pr
|
|||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif_azure.inc');
|
||||
require('skipif_versions_old.inc'); ?>
|
||||
<?php require('skipif_versions_old.inc'); ?>
|
||||
<?php require('skipif_azure.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once('MsCommon.inc');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
data corruption fix.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
Fix for 168256.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure('WarningsReturnAsErrors', 0);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
Fix for 168256.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure('WarningsReturnAsErrors', 0);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
fix for 182741.
|
||||
--SKIPIF--
|
||||
<?php require('skipif_versions_old.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure('WarningsReturnAsErrors', 0);
|
||||
|
|
12
test/functional/sqlsrv/skipif_azure_dw.inc
Normal file
12
test/functional/sqlsrv/skipif_azure_dw.inc
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
if (!extension_loaded("sqlsrv")) {
|
||||
die("skip extension not loaded");
|
||||
}
|
||||
|
||||
require_once('MsCommon.inc');
|
||||
if (isAzureDW()) {
|
||||
die("skip test not applicable in Azure Data Warehouse\n");
|
||||
}
|
||||
|
||||
?>
|
|
@ -6,6 +6,7 @@ Verifies the functionality of sqlsrv_next_result
|
|||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif_versions_old.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
|
@ -15,26 +15,21 @@ $connectionInfo = array( "Database"=>$databaseName, "UID"=>$uid, "PWD"=>$pwd,
|
|||
|
||||
$conn = sqlsrv_connect($server, $connectionInfo);
|
||||
|
||||
if( $conn === false )
|
||||
{
|
||||
if ($conn === false) {
|
||||
echo "Could not connect with Authentication=SqlPassword.\n";
|
||||
var_dump(sqlsrv_errors());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "Connected successfully with Authentication=SqlPassword.\n";
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "SELECT count(*) FROM cd_info" );
|
||||
if ( $stmt === false )
|
||||
{
|
||||
// For details, https://docs.microsoft.com/sql/t-sql/functions/serverproperty-transact-sql
|
||||
$stmt = sqlsrv_query($conn, "SELECT SERVERPROPERTY('EngineEdition')");
|
||||
if (sqlsrv_fetch($stmt)) {
|
||||
$edition = sqlsrv_get_field($stmt, 0);
|
||||
var_dump($edition);
|
||||
} else {
|
||||
echo "Query failed.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = sqlsrv_fetch_array( $stmt );
|
||||
var_dump( $result );
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
sqlsrv_close($conn);
|
||||
|
@ -46,14 +41,11 @@ sqlsrv_close( $conn );
|
|||
$connectionInfo = array( "Authentication"=>"ActiveDirectoryIntegrated", "TrustServerCertificate"=>true );
|
||||
|
||||
$conn = sqlsrv_connect($server, $connectionInfo);
|
||||
if( $conn === false )
|
||||
{
|
||||
if ($conn === false) {
|
||||
echo "Could not connect with Authentication=ActiveDirectoryIntegrated.\n";
|
||||
$errors = sqlsrv_errors();
|
||||
print_r($errors[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "Connected successfully with Authentication=ActiveDirectoryIntegrated.\n";
|
||||
sqlsrv_close($conn);
|
||||
}
|
||||
|
@ -67,36 +59,25 @@ $azureDatabase = $adDatabase;
|
|||
$azureUsername = $adUser;
|
||||
$azurePassword = $adPassword;
|
||||
|
||||
if ($azureServer != 'TARGET_AD_SERVER')
|
||||
{
|
||||
if ($azureServer != 'TARGET_AD_SERVER') {
|
||||
$connectionInfo = array( "UID"=>$azureUsername, "PWD"=>$azurePassword,
|
||||
"Authentication"=>'ActiveDirectoryPassword', "TrustServerCertificate"=>false );
|
||||
|
||||
$conn = sqlsrv_connect($azureServer, $connectionInfo);
|
||||
if( $conn === false )
|
||||
{
|
||||
if ($conn === false) {
|
||||
echo "Could not connect with ActiveDirectoryPassword.\n";
|
||||
print_r(sqlsrv_errors());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "Connected successfully with Authentication=ActiveDirectoryPassword.\n";
|
||||
sqlsrv_close($conn);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "Not testing with Authentication=ActiveDirectoryPassword.\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Connected successfully with Authentication=SqlPassword.
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(7)
|
||||
[""]=>
|
||||
int(7)
|
||||
}
|
||||
string(1) "%d"
|
||||
Could not connect with Authentication=ActiveDirectoryIntegrated.
|
||||
Array
|
||||
(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
large types to strings of 1MB size.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
integer, float, and datetime types vs various sql server types.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
field metadata for all types.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
Read varchar(max) fields from a stream
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ require_once('MsCommon.inc');
|
|||
$conn = AE\connect();
|
||||
|
||||
// Prepare the statement
|
||||
$sql = "select * from cd_info";
|
||||
$sql = "SELECT * FROM sys.objects";
|
||||
|
||||
$stmt = sqlsrv_prepare($conn, $sql, array(), array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
if ($stmt === false) {
|
||||
printErrors();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
using an already closed connection.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
various fetch types.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
nameless fields return correctly in sqlsrv_fetch_array and sqlsrv_fetch_object.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
Insert nulls into fields of all types.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
send a large amount (10MB) using encryption.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class my_stream {
|
||||
|
|
|
@ -4,7 +4,7 @@ test new error messages when sqlsrv_get_field is called
|
|||
new error messages when sqlsrv_get_field is called before sqlsrv_fetch or
|
||||
if sqlsrv_get_field is called with out of order field indices.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
<?php require('skipif_azure_dw.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
Binary file not shown.
|
@ -14,7 +14,7 @@ Test for stream zombifying.
|
|||
fatalError("Failed to connect.");
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query($conn, "SELECT * FROM [test_streamable_types]");
|
||||
$stmt = sqlsrv_query($conn, "SELECT * FROM sys.objects");
|
||||
$metadata = sqlsrv_field_metadata($stmt);
|
||||
$count = count($metadata);
|
||||
sqlsrv_fetch($stmt);
|
||||
|
|
|
@ -15,7 +15,7 @@ if( $conn === false ) {
|
|||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "SELECT * FROM [cd_info]");
|
||||
$stmt = sqlsrv_prepare( $conn, "SELECT * FROM sys.objects");
|
||||
|
||||
$result = sqlsrv_field_metadata( $stmt );
|
||||
if( $result === false ) {
|
||||
|
|
Loading…
Reference in a new issue