Skip to content

Commit

Permalink
[Service Fabric] breaking changes deprecate cmdlets and parameters (A…
Browse files Browse the repository at this point in the history
…zure#14964)

* use ps modules for service instead of sdk models

* remove deprecated cluster cert cmdlets add/remove

* remove deprecated parameters for managed cmdlets

* update help files

* remove DropSourceReplicaOnMove and update changelog

* fix managed app/service tests and add breaking changes exceptions

* record managed app/service test and add missing breaking exceptions

* remove unused models

* Update BreakingChangeIssues.csv

Co-authored-by: Alfredo Santamaria Gomez <[email protected]>
Co-authored-by: Yunchi Wang <[email protected]>
  • Loading branch information
3 people authored May 13, 2021
1 parent da02fe9 commit d52d8b6
Show file tree
Hide file tree
Showing 33 changed files with 3,141 additions and 3,898 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function Test-ManagedApp
Assert-AreEqual $app.Id $appFromGet.Id

$service = New-AzServiceFabricManagedClusterService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Stateless -InstanceCount -1 -ApplicationName $appName -Name $serviceName -Type $statelessServiceTypeName -PartitionSchemeSingleton -Verbose
Assert-AreEqual "Succeeded" $service.Properties.ProvisioningState
Assert-AreEqual "Succeeded" $service.ProvisioningState

$serviceFromGet = Get-AzServiceFabricManagedClusterService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationName $appName -Name $serviceName
Assert-NotNull $serviceFromGet
Expand Down Expand Up @@ -221,15 +221,15 @@ function Test-ManagedService
$statefulService = New-AzServiceFabricManagedClusterService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Stateful -TargetReplicaSetSize 3 `
-MinReplicaSetSize 2 -HasPersistedState -ApplicationName $appName -Name $statefulServiceName -Type $statefulServiceTypeName -PartitionSchemeUniformInt64 `
-PartitionCount 1 -LowKey 0 -HighKey 25 -Verbose
Assert-AreEqual "Succeeded" $statefulService.Properties.ProvisioningState
Assert-AreEqual "Succeeded" $statefulService.ProvisioningState

$statefulServiceFromGet = Get-AzServiceFabricManagedClusterService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationName $appName -Name $statefulServiceName
Assert-NotNull $statefulServiceFromGet
Assert-AreEqual $statefulService.Id $statefulServiceFromGet.Id

$statelessService = New-AzServiceFabricManagedClusterService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Stateless -InstanceCount -1 `
-ApplicationName $appName -Name $statelessServiceName -Type $statelessServiceTypeName -PartitionSchemeSingleton -Verbose
Assert-AreEqual "Succeeded" $statelessService.Properties.ProvisioningState
Assert-AreEqual "Succeeded" $statelessService.ProvisioningState

$statelessServiceFromGet = Get-AzServiceFabricManagedClusterService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationName $appName -Name $statelessServiceName
Assert-NotNull $statelessServiceFromGet
Expand All @@ -242,20 +242,20 @@ function Test-ManagedService

$statefulService = $statefulServiceFromGet | Set-AzServiceFabricManagedClusterService -Stateful -ReplicaRestartWaitDuration $replicaRestartWaitDuration -QuorumLossWaitDuration $quorumLossWaitDuration `
-StandByReplicaKeepDuration $standByReplicaKeepDuration -ServicePlacementTimeLimit $servicePlacementTimeLimit -Verbose
Assert-AreEqual "Succeeded" $statefulService.Properties.ProvisioningState
Assert-AreEqual $replicaRestartWaitDuration $statefulService.Properties.ReplicaRestartWaitDuration
Assert-AreEqual $quorumLossWaitDuration $statefulService.Properties.QuorumLossWaitDuration
Assert-AreEqual $standByReplicaKeepDuration $statefulService.Properties.StandByReplicaKeepDuration
Assert-AreEqual $servicePlacementTimeLimit $statefulService.Properties.ServicePlacementTimeLimit
Assert-AreEqual "Succeeded" $statefulService.ProvisioningState
Assert-AreEqual $replicaRestartWaitDuration $statefulService.ReplicaRestartWaitDuration
Assert-AreEqual $quorumLossWaitDuration $statefulService.QuorumLossWaitDuration
Assert-AreEqual $standByReplicaKeepDuration $statefulService.StandByReplicaKeepDuration
Assert-AreEqual $servicePlacementTimeLimit $statefulService.ServicePlacementTimeLimit

$minInstancePercentage = 20
$minInstanceCount = 2

$statelessService = $statelessServiceFromGet | Set-AzServiceFabricManagedClusterService -Stateless -MinInstancePercentage $minInstancePercentage `
-MinInstanceCount $minInstanceCount -Verbose
Assert-AreEqual "Succeeded" $statelessService.Properties.ProvisioningState
Assert-AreEqual $minInstancePercentage $statelessService.Properties.MinInstancePercentage
Assert-AreEqual $minInstanceCount $statelessService.Properties.MinInstanceCount
Assert-AreEqual "Succeeded" $statelessService.ProvisioningState
Assert-AreEqual $minInstancePercentage $statelessService.MinInstancePercentage
Assert-AreEqual $minInstanceCount $statelessService.MinInstanceCount

$removeStatefulServiceResponse = Remove-AzServiceFabricManagedClusterService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationName $appName -Name $statefulServiceName -Force -PassThru -Verbose
Assert-True { $removeStatefulServiceResponse }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,34 +82,6 @@ public void TestRemoveAzureRmServiceFabricSettings()
TestController.NewInstance.RunPsTest(_logger, "Test-RemoveAzureRmServiceFabricSettings");
}

[Fact, TestPriority(0)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmServiceFabricClusterCertificateCNNotAllowed()
{
TestController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmServiceFabricClusterCertificateCNNotAllowed");
}

[Fact, TestPriority(0)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmServiceFabricClusterCertificate()
{
TestController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmServiceFabricClusterCertificate");
}

[Fact, TestPriority(1)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoveAzureRmServiceFabricClusterCertificate()
{
TestController.NewInstance.RunPsTest(_logger, "Test-RemoveAzureRmServiceFabricClusterCertificate");
}

[Fact, TestPriority(2)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoveAzureRmServiceFabricClusterCertificateNotAllowed()
{
TestController.NewInstance.RunPsTest(_logger, "Test-RemoveAzureRmServiceFabricClusterCertificateNotAllowed");
}

[Fact, TestPriority(0)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmServiceFabricClientCertificate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,77 +41,6 @@ function Test-UpdateAzureRmServiceFabricReliability
Assert-AreEqual $clusters[0].ReliabilityLevel $reliabilityLevel
}

function Test-AddAzureRmServiceFabricClusterCertificate
{
$clusterName = Get-ClusterName
$resourceGroupName = Get-ResourceGroupName
$keyvaulturi = Get-SecretUrl

WaitForClusterReadyStateIfRecord $clusterName $resourceGroupName

$cluster = Add-AzServiceFabricClusterCertificate -ResourceGroupName $resourceGroupName -ClusterName $clusterName -SecretIdentifier $keyvaulturi -Verbose
$clusters = Get-AzServiceFabricCluster -ClusterName $clusterName -ResourceGroupName $resourceGroupName
Assert-NotNull $clusters[0].Certificate.ThumbprintSecondary
}

function Test-AddAzureRmServiceFabricClusterCertificateCNNotAllowed
{
$clusterName = Get-ClusterName
$resourceGroupName = Get-ResourceGroupName
$keyvaulturi = Get-SecretUrl
$commonName = Get-CACertCommonName
$issuerThumbprint = Get-CACertIssuerThumbprint

$exceptionThrown = $false

Try
{
$cluster = Add-AzServiceFabricClusterCertificate -ResourceGroupName $resourceGroupName -ClusterName $clusterName -SecretIdentifier $keyvaulturi `
-CertificateCommonName $commonName -CertificateIssuerThumbprint $issuerThumbprint -Verbose -ErrorAction Stop
}
Catch [System.Management.Automation.PSInvalidOperationException]
{
Assert-AreEqual $true ($PSItem.Exception.Message -match 'Unable to mix certificates by common name and thumbprint')
$exceptionThrown = $true
}

Assert-AreEqual $true $exceptionThrown "Expected Exception mix certs not thrown"

}

function Test-RemoveAzureRmServiceFabricClusterCertificate
{
$clusterName = Get-ClusterName
$resourceGroupName = Get-ResourceGroupName
$thumbprint = Get-InitialThumbprint

WaitForClusterReadyStateIfRecord $clusterName $resourceGroupName

$cluster = Remove-AzServiceFabricClusterCertificate -ClusterName $clusterName -ResourceGroupName $resourceGroupName -Thumbprint $thumbprint -Verbose
$clusters = Get-AzServiceFabricCluster -ClusterName $clusterName -ResourceGroupName $resourceGroupName
Assert-Null $clusters[0].Certificate.ThumbprintSecondary
}

function Test-RemoveAzureRmServiceFabricClusterCertificateNotAllowed
{
$clusterName = Get-ClusterName
$resourceGroupName = Get-ResourceGroupName
$thumbprint = Get-Thumbprint

$exceptionThrown = $false
Try
{
$cluster = Remove-AzServiceFabricClusterCertificate -ClusterName $clusterName -ResourceGroupName $resourceGroupName -Thumbprint $thumbprint -Verbose -ErrorAction Stop
}
Catch [System.InvalidOperationException]
{
Assert-AreEqual $true ($PSItem.Exception.Message -match 'There is only one certificate in the cluster')
$exceptionThrown = $true
}

Assert-AreEqual $true $exceptionThrown "Expected Exception only one cert not thrown"
}

function Test-AddAzureRmServiceFabricClientCertificate
{
$clusterName = Get-ClusterName
Expand Down
Loading

0 comments on commit d52d8b6

Please sign in to comment.