Skip to content

Commit

Permalink
Users/subraman/errmsgemptyfix (#4135)
Browse files Browse the repository at this point in the history
* Fixing error message empty in cases

* Bumped Patch Version
  • Loading branch information
mvvsubbu authored Apr 26, 2017
1 parent 7a7d703 commit 13bfbae
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
10 changes: 3 additions & 7 deletions Tasks/SqlAzureDacpacDeployment/Tests/L0UtilityIPRange.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ param()
$sqlErrorMsg = "Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Cannot open server 'a0nuel7r2k' requested by the login. Client with IP address '167.220.238.x' is not allowed to access the server. To enable access, use the Windows Azure Management P
ortal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range. It may take up to five minutes for this change to take effect..
"
$Message = New-Object PsObject($sqlErrorMsg)
$Exception = New-Object PsObject
$Exception | Add-Member -MemberType NoteProperty -Name "Message" -Value $Message
$err = New-Object PsObject
$err | Add-Member -MemberType NoteProperty -Name "Exception" -Value $Exception
$firewallException = New-Object -TypeName System.Management.Automation.RemoteException -ArgumentList $sqlErrorMsg
$errors = @()
$errors += $err
$errors += $firewallException

$sqlCmd1 = New-Object PsObject
$sqlCmd1 | Add-Member -MemberType NoteProperty -Name "Path" -Value "SqlCmd.exe"
Expand All @@ -26,7 +22,7 @@ Register-Mock Get-Command { Write-Output $sqlCmd1 } -ParametersEvaluator { $Name
$startIP = "167.220.238.0"
$endIP = "167.220.238.255"

Register-Mock Invoke-Expression { Write-Error $sqlErrorMsg } -ParametersEvaluator { }
Register-Mock Invoke-Expression { Write-Error $firewallException } -ParametersEvaluator { }
$IPAddressRange = Get-AgentIPRange -serverName $serverName -sqlUserName $sqlUsername -sqlPassword $sqlPassword

Assert-AreEqual $startIP $IPAddressRange.StartIPAddress
Expand Down
4 changes: 2 additions & 2 deletions Tasks/SqlAzureDacpacDeployment/Utility.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function Get-AgentIPRange

if($errors.Count -gt 0)
{
$errorMsg = $errors[0].Exception.Message
Write-Verbose $errorMsg
$errorMsg = $errors[0].ToString()
Write-Verbose "Error Message: $errorMsg"

$pattern = "([0-9]+).([0-9]+).([0-9]+)."
$regex = New-Object -TypeName System.Text.RegularExpressions.Regex -ArgumentList $pattern
Expand Down
2 changes: 1 addition & 1 deletion Tasks/SqlAzureDacpacDeployment/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": {
"Major": 1,
"Minor": 1,
"Patch": 12
"Patch": 13
},
"demands": [
"sqlpackage"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/SqlAzureDacpacDeployment/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": {
"Major": 1,
"Minor": 1,
"Patch": 12
"Patch": 13
},
"demands": [
"sqlpackage"
Expand Down

0 comments on commit 13bfbae

Please sign in to comment.