Skip to content

huangpf PR: dev <- Azure:dev #565

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 20 commits into from
Jun 29, 2016
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
27,895 changes: 13,005 additions & 14,890 deletions src/ResourceManager/AzureBatch/Commands.Batch/Microsoft.Azure.Commands.Batch.dll-Help.xml

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,20 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="ScenarioTests\DatabaseBackupStretchTests.cs" />
<Compile Include="ScenarioTests\DatabaseCrudStretchTests.cs" />
<Compile Include="ScenarioTests\ThreatDetectionTests.cs" />
<Compile Include="ScenarioTests\DatabaseActivationTests.cs" />
<Compile Include="ScenarioTests\DatabaseBackupTests.cs" />
<Compile Include="ScenarioTests\DatabaseReplicationTests.cs" />
<Compile Include="ScenarioTests\DatabaseCrudTests.cs" />
<Compile Include="ScenarioTests\DataMaskingTests.cs" />
<None Include="ScenarioTests\DatabaseBackupStretchTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\DatabaseCrudStretchTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\ThreatDetectionTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -419,6 +427,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseActivationTests\TestDatabasePauseResumePiped.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseBackupStretchTests\TestStretchDatabaseListRestorePoints.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseBackupTests\TestListDatabaseRestorePoints.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -440,6 +451,18 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseBackupTests\TestDatabaseBackupLongTermRetentionPolicy.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseCrudStretchTests\TestStretchDatabaseCreate.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseCrudStretchTests\TestStretchDatabaseGet.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseCrudStretchTests\TestStretchDatabaseRemove.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseCrudStretchTests\TestStretchDatabaseUpdate.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseCrudTests\TestDatabaseCreate.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
29 changes: 29 additions & 0 deletions src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/Common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,35 @@ function Get-ElasticPoolName
return getAssetName
}

<#
.SYNOPSIS
Gets the location for a provider, if not found return East US
#>
function Get-ProviderLocation($provider)
{
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
{
$namespace = $provider.Split("/")[0]
if($provider.Contains("/"))
{
$type = $provider.Substring($namespace.Length + 1)
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}

if ($location -eq $null)
{
return "East US"
} else
{
return $location.Locations[0]
}
}

return "East US"
}

return "East US"
}

<#
.SYNOPSIS
Creates a resource group for tests
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// ----------------------------------------------------------------------------------
//
// 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.Mocks;
using Microsoft.Azure.Commands.ScenarioTest.SqlTests;
using Microsoft.Azure.ServiceManagemenet.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests
{
public class DatabaseBackupStretchTests : SqlTestsBase
{
/// <summary>
/// Follow the way how AuditingTests setup their manangement clients
/// Only overide SetupManagementClients() here because stretch database
/// tests in this test suite now use V2 version of storage client
/// </summary>
protected override void SetupManagementClients()
{
var sqlCSMClient = GetSqlClient();
var storageClient = GetStorageV2Client();

// TODO, Remove the MockDeploymentFactory call when the test is re-recorded
//
var resourcesClient = MockDeploymentClientFactory.GetResourceClient(GetResourcesClient());
var authorizationClient = GetAuthorizationManagementClient();
helper.SetupSomeOfManagementClients(sqlCSMClient, storageClient, resourcesClient,
authorizationClient);
}

public DatabaseBackupStretchTests(ITestOutputHelper output)
{
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestStretchDatabaseListRestorePoints()
{
RunPowerShellTest("Test-ListStretchDatabaseRestorePoints");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ----------------------------------------------------------------------------------
#
# 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
Test getting restore points from stretch databases
#>
function Test-ListStretchDatabaseRestorePoints
{
# Setup
$location = Get-ProviderLocation "Microsoft.Sql/servers"
$serverVersion = "12.0";
$rg = Create-ResourceGroupForTest $location

try
{
$server = Create-ServerForTest $rg $serverVersion $location

# Create stretch database with all parameters.
$databaseName = Get-DatabaseName
$stretchdb = New-AzureRmSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName `
-Edition Stretch -RequestedServiceObjectiveName DS100

# Get restore points from stretch database.
$restorePoints = Get-AzureRmSqlDatabaseRestorePoints -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $stretchdb.DatabaseName
Assert-Null $restorePoints # Since the stretch database has just been created, it should not have any discrete restore points.
}
finally
{
Remove-ResourceGroupForTest $rg
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// ----------------------------------------------------------------------------------
//
// 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.Mocks;
using Microsoft.Azure.Commands.ScenarioTest.SqlTests;
using Microsoft.Azure.ServiceManagemenet.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests
{
public class DatabaseCrudStretchTests : SqlTestsBase
{
/// <summary>
/// Follow the way how AuditingTests setup their manangement clients
/// Only overide SetupManagementClients() here because stretch database
/// tests in this test suite now use V2 version of storage client
/// </summary>
protected override void SetupManagementClients()
{
var sqlCSMClient = GetSqlClient();
var storageClient = GetStorageV2Client();

// TODO, Remove the MockDeploymentFactory call when the test is re-recorded
//
var resourcesClient = MockDeploymentClientFactory.GetResourceClient(GetResourcesClient());
var authorizationClient = GetAuthorizationManagementClient();
helper.SetupSomeOfManagementClients(sqlCSMClient, storageClient, resourcesClient,
authorizationClient);
}

public DatabaseCrudStretchTests(ITestOutputHelper output)
{
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestStretchDatabaseCreate()
{
RunPowerShellTest("Test-CreateStretchDatabase");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestStretchDatabaseUpdate()
{
RunPowerShellTest("Test-UpdateStretchDatabase");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestStretchDatabaseGet()
{
RunPowerShellTest("Test-GetStretchDatabase");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestStretchDatabaseRemove()
{
RunPowerShellTest("Test-RemoveStretchDatabase");
}
}
}
Loading