Skip to content

Avoid Get-Location hardcode in AnalysisServices.Test #7918

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

Merged
merged 1 commit into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function Test-AnalysisServicesServer
try
{
# Creating server
$location = Get-Location
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
$backupBlobContainerUri = $env:AAS_DEFAULT_BACKUP_BLOB_CONTAINER_URI
Expand Down Expand Up @@ -105,9 +105,8 @@ function Test-AnalysisServicesServer
Suspend-AzureRmAnalysisServicesServer -ResourceGroupName $resourceGroupName -Name $serverName
[array]$serverGet = Get-AzureRmAnalysisServicesServer -ResourceGroupName $resourceGroupName -Name $serverName
$serverGetItem = $serverGet[0]
# this is to ensure backward compatibility compatibility. The servie side would make change to differenciate state and provisioningState in future
Assert-True {$serverGetItem.State -like "Paused"}
Assert-True {$serverGetItem.ProvisioningState -like "Paused"}
# Assert-True {$serverGetItem.ProvisioningState -like "Succeeded"} # TODO: Uncomment this in future after fix is deployed.

# Resume Analysis Servicesserver
Resume-AzureRmAnalysisServicesServer -ResourceGroupName $resourceGroupName -Name $serverName
Expand Down Expand Up @@ -139,7 +138,7 @@ function Test-AnalysisServicesServerScaleUpDown
try
{
# Creating server
$location = Get-Location
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
Expand Down Expand Up @@ -195,7 +194,7 @@ function Test-AnalysisServicesServerFirewall
try
{
# Creating server
$location = Get-Location Microsoft.AnalysisServices 'servers' 'West US'
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
Expand Down Expand Up @@ -262,7 +261,7 @@ function Test-AnalysisServicesServerScaleOutIn
try
{
# Creating server
$location = Get-Location Microsoft.AnalysisServices 'servers' 'West US'
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
Expand Down Expand Up @@ -324,7 +323,7 @@ function Test-AnalysisServicesServerDisableBackup
try
{
# Creating server
$location = Get-Location
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
$backupBlobContainerUri = $env:AAS_DEFAULT_BACKUP_BLOB_CONTAINER_URI
Expand Down Expand Up @@ -390,7 +389,7 @@ function Test-NegativeAnalysisServicesServer
try
{
# Creating Account
$location = Get-Location
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
Expand Down Expand Up @@ -450,7 +449,7 @@ function Test-AnalysisServicesServerLogExport
)
try
{
$location = Get-Location
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
Expand Down Expand Up @@ -498,7 +497,7 @@ function Test-AnalysisServicesServerRestart
try
{
# Creating server
$location = Get-Location
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
Expand Down Expand Up @@ -554,7 +553,7 @@ function Test-AnalysisServicesServerSynchronizeSingle
try
{
# Creating server
$location = Get-Location
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
Expand Down Expand Up @@ -633,7 +632,7 @@ function Test-AnalysisServicesServerGateway
try
{
# Creating server
$location = Get-Location
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
$gatewayName = $env:GATEWAY_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ function Get-ResourceGroupName

<#
.SYNOPSIS
Gets a location for testing.
Gets a location for testing Azure Analysis Services.
#>
function Get-Location
function Get-AnalysisServicesLocation
{
# TODO: should be implemented via Get-AzureRmResourceProvider
return "West US"
return Get-Location -providerNamespace "Microsoft.AnalysisServices" -resourceType "servers" -preferredLocation "West US"
}

<#
Expand Down