Skip to content

Added alias for New-AzSqlServerTrustGroup cmdlet and fixed tests #15974

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 2 commits into from
Sep 29, 2021
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
2 changes: 1 addition & 1 deletion src/Sql/Sql.Test/ScenarioTests/ServerTrustGroupTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected override void SetupManagementClients(RestTestFramework.MockContext con
Helper.SetupSomeOfManagementClients(newResourcesClient, sqlClient, networkClient, graphClient);
}

[Fact(Skip = "Cannot re-record.")]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestServerTrustGroup()
{
Expand Down
16 changes: 10 additions & 6 deletions src/Sql/Sql.Test/ScenarioTests/ServerTrustGroupTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

function Test-ServerTrustGroup()
{
$stgName = "stg-test"
$location = "West Europe"
$stgName = "stg-ps-test"
$location = "westeurope"

# Setup
$rg = Create-ResourceGroupForTest $location
Expand All @@ -29,6 +29,7 @@ function Test-ServerTrustGroup()
# Setup Managed Instances
$managedInstance1 = Create-ManagedInstanceForTest $rg $subnetId
$managedInstance2 = Create-ManagedInstanceForTest $rg $subnetId
$managedInstance3 = Create-ManagedInstanceForTest $rg $subnetId

try
{
Expand All @@ -42,15 +43,15 @@ function Test-ServerTrustGroup()
Assert-Null $serverTrustGroup "Server Trust Group with name $stgName exists."

# Create new Server Trust Group
$serverTrustGroup = New-AzSqlServerTrustGroup -ResourceGroupName $rg.ResourceGroupName -Location $location -Name $stgName -GroupMember $managedInstance1,$managedInstance2 -TrustScope GlobalTransactions
$serverTrustGroup = Set-AzSqlServerTrustGroup -ResourceGroupName $rg.ResourceGroupName -Location $location -Name $stgName -GroupMember $managedInstance1,$managedInstance2,$managedInstance3 -TrustScope GlobalTransactions
Assert-NotNull $serverTrustGroup "Server Trust Group is not created."

# Get specified Server Trust Group
$serverTrustGroup = Get-AzSqlServerTrustGroup -ResourceGroupName $rg.ResourceGroupName -Location $location -Name $stgName
Assert-NotNull $serverTrustGroup "Server Trust Group $stgName does not exist."
Assert-AreEqual $serverTrustGroup.Name $stgName "Got unexpected name."
Assert-AreEqual $serverTrustGroup.TrustScope.Count 1 "Got unexpected trust scope."
Assert-AreEqual $serverTrustGroup.GroupMember.Count 2 "Got unexpected number of group members."
Assert-AreEqual $serverTrustGroup.GroupMember.Count 3 "Got unexpected number of group members."

# Get Server Trust Group in specified locaiton
$serverTrustGroups = Get-AzSqlServerTrustGroup -ResourceGroupName $rg.ResourceGroupName -Location $location
Expand All @@ -62,6 +63,10 @@ function Test-ServerTrustGroup()
Assert-NotNull $serverTrustGroups
Assert-AreEqual $serverTrustGroups.Count 1 "Unexpected number of Server Trust Groups for instance. ($($serverTrustGroup.Count))."

# Update Server Trust Group
$serverTrustGroup = Set-AzSqlServerTrustGroup -ResourceGroupName $rg.ResourceGroupName -Location $location -Name $stgName -GroupMember $managedInstance1,$managedInstance2 -TrustScope GlobalTransactions
Assert-NotNull $serverTrustGroup "Server Trust Group is not created."

# Remove Server Trust Group
Remove-AzSqlServerTrustGroup -ResourceGroupName $rg.ResourceGroupName -Location $location -Name $stgName
Assert-NotNull $serverTrustGroups
Expand All @@ -86,5 +91,4 @@ function Test-ServerTrustGroup()
{
Remove-ResourceGroupForTest $rg
}
}

}
Loading