Skip to content

. #54

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 4 commits into from
Jul 22, 2015
Merged

. #54

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 @@ -392,12 +392,8 @@ function Test-NetworkInterfaceIDns
$domainNameLabel = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement
$resourceTypeParent = "Microsoft.Network/networkInterfaces"
<#
uncomment after IDNS is enabled in all locations
$location = Get-ProviderLocation $resourceTypeParent
#>
$location = "centralus"


try
{
# Create the resource group
Expand Down Expand Up @@ -451,8 +447,7 @@ function Test-NetworkInterfaceEnableIPForwarding
$nicName = Get-ResourceName
$domainNameLabel = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement
$resourceTypeParent = "Microsoft.Network/networkInterfaces"

$resourceTypeParent = "Microsoft.Network/networkInterfaces"
$location = Get-ProviderLocation $resourceTypeParent

try
Expand Down

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@
<Compile Include="ScenarioTests\DatabaseBackupTests.cs" />
<Compile Include="ScenarioTests\DatabaseCrudTests.cs" />
<Compile Include="ScenarioTests\DataMaskingTests.cs" />
<None Include="ScenarioTests\ServiceTierAdvisorTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\DatabaseActivationTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -170,6 +173,7 @@
<None Include="ScenarioTests\ElasticPoolCrudTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="ScenarioTests\ServiceTierAdvisorTests.cs" />
<Compile Include="ScenarioTests\RecommendedElasticPoolTests.cs" />
<Compile Include="ScenarioTests\ElasticPoolCrudTests.cs" />
<Compile Include="ScenarioTests\SecurityTests.cs" />
Expand All @@ -184,6 +188,7 @@
<Compile Include="UnitTests\AzureSqlDatabaseServerFirewallRuleAttributeTests.cs" />
<Compile Include="UnitTests\AzureSqlDatabaseServerAttributeTests.cs" />
<Compile Include="UnitTests\AzureSqlServerUpgradeAttributeTests.cs" />
<Compile Include="UnitTests\AzureSqlServiceTierAdvisorAttributeTests.cs" />
<Compile Include="UnitTests\AzureSqlDatabaseBackupAttributeTests.cs" />
<Compile Include="Utilities\UnitTestHelper.cs" />
</ItemGroup>
Expand Down Expand Up @@ -381,25 +386,25 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ElasticPoolCrudTests\TestElasticPoolUpdate.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedElasticPoolTests\TestRecommendedElasticPoolGet.json">
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedElasticPoolTests\ListRecommendedElasticPools.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedElasticPoolTests\TestRecommendedElasticPoolGetDatabase.json">
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerCrudTests\TestServerCreate.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedElasticPoolTests\TestRecommendedElasticPoolGetMetrics.json">
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerCrudTests\TestServerGet.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedElasticPoolTests\TestRecommendedElasticPoolList.json">
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerCrudTests\TestServerRemove.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.RecommendedElasticPoolTests\TestRecommendedElasticPoolListDatabase.json">
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerCrudTests\TestServerUpdate.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerCrudTests\TestServerCreate.json">
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServiceTierAdvisorTests\GetUpgradeDatabaseHint.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerCrudTests\TestServerGet.json">
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServiceTierAdvisorTests\GetUpgradeServerHint.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerCrudTests\TestServerRemove.json">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,11 @@ namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests
{
public class RecommendedElasticPoolTests : SqlTestsBase
{
[Fact(Skip="Test needs to be regenerated. Will be done by recommendations team.")]
[Trait(Category.Sql, Category.CheckIn)]
public void TestRecommendedElasticPoolList()
{
RunPowerShellTest("Test-ListRecommendedElasticPools");
}

[Fact]
[Trait(Category.Sql, Category.CheckIn)]
public void TestRecommendedElasticPoolGet()
{
RunPowerShellTest("Test-GetRecommendedElasticPool");
}

[Fact]
[Trait(Category.Sql, Category.CheckIn)]
public void TestRecommendedElasticPoolListDatabase()
{
RunPowerShellTest("Test-ListRecommendedElasticPoolDatabases");
}

[Fact]
[Trait(Category.Sql, Category.CheckIn)]
public void TestRecommendedElasticPoolGetDatabase()
{
RunPowerShellTest("Test-GetRecommendedElasticPoolDatabase");
}

[Fact]
[Trait(Category.Sql, Category.CheckIn)]
public void TestRecommendedElasticPoolGetMetrics()
public void ListRecommendedElasticPools()
{
RunPowerShellTest("Test-GetRecommendedElasticPoolMetrics");
RunPowerShellTest("Test-ElasticPoolRecommendation");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,140 +16,18 @@
.SYNOPSIS
Tests listing all recommended elastic pools for server
#>
function Test-ListRecommendedElasticPools
function Test-ElasticPoolRecommendation
{
# Setup
$rg = Create-ResourceGroupForTest
$server = Create-ServerForTest $rg "Japan East"

try
{
$response = Get-AzureSqlElasticPoolRecommendation -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName
Assert-NotNull $response
Assert-AreEqual 2 $response.Count

Assert-AreEqual "ElasticPool1" $response[0].RecommendedElasticPoolName
Assert-AreEqual "Standard" $response[0].DatabaseEdition
Assert-AreEqual 1000 $response[0].Dtu
Assert-AreEqual 100.6 $response[0].DatabaseDtuMin
Assert-AreEqual 200.5 $response[0].DatabaseDtuMax
Assert-AreEqual 1000.3 $response[0].StorageMB
Assert-AreEqual '11/01/2014 00:00:00' $response[0].ObservationPeriodStart
Assert-AreEqual '11/15/2014 00:00:00' $response[0].ObservationPeriodEnd
Assert-AreEqual 900.2 $response[0].MaxObservedDtu
Assert-AreEqual 350 $response[0].MaxObservedStorageMB
}
finally
{
Remove-ResourceGroupForTest $rg
}
}

<#
.SYNOPSIS
Tests getting recommended elastic pool by name
#>
function Test-GetRecommendedElasticPool
{
# Setup
$rg = Create-ResourceGroupForTest
$server = Create-ServerForTest $rg "Japan East"

try
{
$response = Get-AzureSqlElasticPoolRecommendation -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -ElasticPoolRecommendation "ElasticPool1"
Assert-NotNull $response

Assert-AreEqual "ElasticPool1" $response.RecommendedElasticPoolName
Assert-AreEqual "Standard" $response.DatabaseEdition
Assert-AreEqual 1000 $response.Dtu
Assert-AreEqual 100.6 $response.DatabaseDtuMin
Assert-AreEqual 200.5 $response.DatabaseDtuMax
Assert-AreEqual 1000.3 $response.StorageMB
Assert-AreEqual '11/01/2014 00:00:00' $response.ObservationPeriodStart
Assert-AreEqual '11/15/2014 00:00:00' $response.ObservationPeriodEnd
Assert-AreEqual 900.2 $response.MaxObservedDtu
Assert-AreEqual 350 $response.MaxObservedStorageMB
}
finally
{
Remove-ResourceGroupForTest $rg
}
}

<#
.SYNOPSIS
Tests listing all databases in recommended elastic pool
#>
function Test-ListRecommendedElasticPoolDatabases
{
# Setup
$rg = Create-ResourceGroupForTest
$server = Create-ServerForTest $rg "Japan East"

try
{
$response = Get-AzureSqlElasticPoolRecommendationDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -ElasticPoolRecommendation "ElasticPool1"
Assert-NotNull $response
Assert-AreEqual 1 $response.Count

Assert-AreEqual 'TestDb1' $response[0].DatabaseName
Assert-AreEqual '28acaef5-d228-4660-bb67-546ec8482496' $response[0].DatabaseId
Assert-AreEqual 'Online' $response[0].Status
}
finally
{
Remove-ResourceGroupForTest $rg
}
}

<#
.SYNOPSIS
Tests getting database by name for specific recommended elastic pool
#>
function Test-GetRecommendedElasticPoolDatabase
{
# Setup
$rg = Create-ResourceGroupForTest
$server = Create-ServerForTest $rg "Japan East"

try
{
$response = Get-AzureSqlElasticPoolRecommendationDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -ElasticPoolRecommendation "ElasticPool1" -DatabaseName "TestDb1"
Assert-NotNull $response

Assert-AreEqual 'TestDb1' $response.DatabaseName
Assert-AreEqual '28acaef5-d228-4660-bb67-546ec8482496' $response.DatabaseId
Assert-AreEqual 'Online' $response.Status
}
finally
{
Remove-ResourceGroupForTest $rg
}
}

<#
.SYNOPSIS
Tests listing metrics for specific recommended elastic pool
#>
function Test-GetRecommendedElasticPoolMetrics
{
# Setup
$rg = Create-ResourceGroupForTest
$server = Create-ServerForTest $rg "Japan East"

try
{
$response = Get-AzureSqlElasticPoolRecommendationMetrics -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -ElasticPoolRecommendation "ElasticPool1"
Assert-NotNull $response
Assert-AreEqual 3 $response.Count

Assert-AreEqual '04/01/2015 00:00:00' $response[0].DateTime
Assert-AreEqual 100.5 $response[0].Dtu
Assert-AreEqual 15.4 $response[0].SizeGB
}
finally
{
Remove-ResourceGroupForTest $rg
}
$response = Get-AzureSqlElasticPoolRecommendation -ResourceGroupName TestRg -ServerName test-srv-v1
Assert-NotNull $response
Assert-AreEqual 2 $response.Count

Assert-AreEqual "ElasticPool2" $response[1].Name
Assert-AreEqual "Standard" $response[1].Edition
Assert-AreEqual 1000 $response[1].Dtu
Assert-AreEqual 100 $response[1].DatabaseDtuMin
Assert-AreEqual 200 $response[1].DatabaseDtuMax
Assert-AreEqual 0 $response[1].IncludeAllDatabases
Assert-AreEqual 1 $response[1].DatabaseCollection.Count
Assert-AreEqual master $response[1].DatabaseCollection[0]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.ScenarioTest.SqlTests;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests
{
public class ServiceTierAdvisorTests : SqlTestsBase
{
[Fact]
[Trait(Category.Sql, Category.CheckIn)]
public void GetUpgradeDatabaseHint()
{
RunPowerShellTest("Test-GetUpgradeDatabaseHint");
}

[Fact]
[Trait(Category.Sql, Category.CheckIn)]
public void GetUpgradeServerHint()
{
RunPowerShellTest("Test-GetUpgradeServerHint");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Tests getting database upgrade hints
#>
function Test-GetUpgradeDatabaseHint
{
$response = Get-AzureSqlDatabaseUpgradeHint -ResourceGroupName TestRg -ServerName test-srv-v1
Assert-NotNull $response
Assert-AreEqual 1 $response.Count
Assert-AreEqual test-db-v1 $response[0].Name
Assert-AreEqual Premium $response[0].TargetEdition
Assert-AreEqual P2 $response[0].TargetServiceLevelObjective

$response = Get-AzureSqlDatabaseUpgradeHint -ResourceGroupName TestRg -ServerName test-srv-v1 -DatabaseName test-db-v1
Assert-NotNull $response
Assert-AreEqual 1 $response.Count
Assert-AreEqual test-db-v1 $response[0].Name
Assert-AreEqual Standard $response[0].TargetEdition
Assert-AreEqual S0 $response[0].TargetServiceLevelObjective

$response = Get-AzureSqlDatabaseUpgradeHint -ResourceGroupName TestRg -ServerName test-srv-v1 -ExcludeElasticPoolCandidates 1
Assert-NotNull $response
Assert-AreEqual 1 $response.Count
Assert-AreEqual test-db-v1 $response[0].Name
Assert-AreEqual Premium $response[0].TargetEdition
Assert-AreEqual P2 $response[0].TargetServiceLevelObjective

$response = Get-AzureSqlDatabaseUpgradeHint -ResourceGroupName TestRg -ServerName test-srv-v1 -DatabaseName test-db-v1 -ExcludeElasticPoolCandidates 1
Assert-NotNull $response
Assert-AreEqual 1 $response.Count
Assert-AreEqual test-db-v1 $response[0].Name
Assert-AreEqual Standard $response[0].TargetEdition
Assert-AreEqual S0 $response[0].TargetServiceLevelObjective
}

<#
.SYNOPSIS
Tests getting server upgrade hint
#>
function Test-GetUpgradeServerHint
{
$response = Get-AzureSqlServerUpgradeHint -ResourceGroupName TestRg -ServerName test-srv-v1
Assert-NotNull $response
Assert-AreEqual 1 $response.Databases.Count
Assert-AreEqual test-db-v1 $response.Databases[0].Name
Assert-AreEqual Standard $response.Databases[0].TargetEdition
Assert-AreEqual S0 $response.Databases[0].TargetServiceLevelObjective

$response = Get-AzureSqlServerUpgradeHint -ResourceGroupName TestRg -ServerName test-srv-v1 -ExcludeElasticPools 1
Assert-NotNull $response
Assert-AreEqual 1 $response.Databases.Count
Assert-AreEqual test-db-v1 $response.Databases[0].Name
Assert-AreEqual Standard $response.Databases[0].TargetEdition
Assert-AreEqual S0 $response.Databases[0].TargetServiceLevelObjective
}
Loading