Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users/subraman/errmsgemptyfix #4135

Merged
merged 4 commits into from
Apr 26, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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