Skip to content

Commit 0d15704

Browse files
committed
Merge branch 'master' of https://github.com/Azure/azure-powershell into manual-failover
2 parents 7b8c102 + 9feb4fe commit 0d15704

File tree

91 files changed

+28895
-8542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+28895
-8542
lines changed

src/ServiceFabric/ServiceFabric.Test/ScenarioTests/Common.ps1

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,25 @@ function Get-NewCertName
6868
function Get-SecretUrl
6969
{
7070
# Thumbprint for this cert should be specified in TestServiceFabric.cs in ServiceFabricCmdletBase.TestThumbprint
71-
return "https://azurermsfkvtest.vault.azure.net:443/secrets/AzureRMSFTestCert2/8ab331aafa88400cbe32e5dc7ea53443"
71+
return "https://azurermsfkvtest.vault.azure.net:443/secrets/AzureRMSFTestCert2/6e96bff504d54f36916489281423b8c6"
7272
}
7373

7474
function Get-Thumbprint
7575
{
7676
# Change the thumbprint in the TestServiceFabric.cs file as well in ServiceFabricCmdletBase.TestThumbprint
77-
return "C20BE98DB1592F7505E24AD92DE072649D691987"
77+
return "910AC565E683987971F34531A824284E3B936040"
7878
}
7979

8080
function Get-CertAppSecretUrl
8181
{
8282
# Thumbprint for this cert should be specified in TestServiceFabric.cs in ServiceFabricCmdletBase.TestThumbprintAppCert
83-
return "https://azurermsfkvtest.vault.azure.net:443/secrets/AzureRMSFTestCertApp/c63c8876220f4384858b0fcde658439e"
83+
return "https://azurermsfkvtest.vault.azure.net:443/secrets/AzureRMSFTestCertApp/ca4c0f7efa254d9ba0b267b8aaebb878"
8484
}
8585

8686
function Get-CertAppThumbprint
8787
{
8888
# Change the thumbprint in the TestServiceFabric.cs file as well in ServiceFabricCmdletBase.TestThumbprintAppCert
89-
return "656AD4B7774A1EAC0AE6C7561B0B2A05154B16B2"
89+
return "EE28AF31B2741B52311A00F78DFF4F46240BB4F8"
9090
}
9191

9292
function Get-CACertCommonName
@@ -101,12 +101,12 @@ function Get-CACertIssuerThumbprint
101101

102102
function Get-CACertSecretUrl
103103
{
104-
return "https://azurermsfkvtest.vault.azure.net:443/secrets/azurermsfcntest/1153e8007bd245b28e3bca5d8794eb91"
104+
return "https://azurermsfkvtest.vault.azure.net:443/secrets/azurermsfcntest/0cd47f8218aa40e3a47e0597b8017247"
105105
}
106106

107107
function Get-CertWUSecretUrl
108108
{
109-
return "https://azurermsfkvtestwu.vault.azure.net:443/secrets/AzureRMSFTestCertWU/5cb0fba2f1fb4e69aec2748fda1bb936"
109+
return "https://azurermsfkvtestwu.vault.azure.net/secrets/AzureRMSFTestCertWU/5250a7acbaa143fa9d493840d4de1c01"
110110
}
111111

112112
function Get-DurabilityLevel
@@ -180,4 +180,36 @@ function WaitForClusterReadyState($clusterName, $resourceGroupName, $timeoutInSe
180180

181181
Write-Error "WaitForClusterReadyState timed out"
182182
return $false
183+
}
184+
185+
# Application functions
186+
187+
function Get-AppTypeName
188+
{
189+
return "CalcServiceApp"
190+
}
191+
192+
function Get-AppTypeV1Name
193+
{
194+
return "1.0"
195+
}
196+
197+
function Get-AppTypeV2Name
198+
{
199+
return "1.1"
200+
}
201+
202+
function Get-AppPackageV1
203+
{
204+
return "https://azsfapptest.blob.core.windows.net/azsfapptest/CalcApp_1.0.sfpkg"
205+
}
206+
207+
function Get-AppPackageV2
208+
{
209+
return "https://azsfapptest.blob.core.windows.net/azsfapptest/CalcApp_1.1.sfpkg"
210+
}
211+
212+
function Get-ServiceTypeName
213+
{
214+
return "CalcServiceType"
183215
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.IO;
17+
using Microsoft.Azure.Commands.ServiceFabric.Commands;
18+
using Microsoft.Azure.Commands.ServiceFabric.Common;
19+
using Microsoft.Azure.ServiceManagement.Common.Models;
20+
using Microsoft.WindowsAzure.Commands.Common;
21+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
22+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
23+
using Xunit;
24+
using Xunit.Abstractions;
25+
26+
namespace Microsoft.Azure.Commands.ServiceFabric.Test.ScenarioTests
27+
{
28+
public class ServiceFabricApplicationTests : RMTestBase
29+
{
30+
public XunitTracingInterceptor _logger;
31+
32+
public ServiceFabricApplicationTests(ITestOutputHelper output)
33+
{
34+
_logger = new XunitTracingInterceptor(output);
35+
XunitTracingInterceptor.AddToContext(_logger);
36+
37+
ServiceFabricCmdletBase.WriteVerboseIntervalInSec = 0;
38+
ServiceFabricCmdletBase.RunningTest = true;
39+
}
40+
41+
[Fact]
42+
[Trait(Category.AcceptanceType, Category.CheckIn)]
43+
public void TestAppType()
44+
{
45+
TestController.NewInstance.RunPsTest(_logger, "Test-AppType");
46+
}
47+
48+
[Fact]
49+
[Trait(Category.AcceptanceType, Category.CheckIn)]
50+
public void TestAppTypeVersion()
51+
{
52+
TestController.NewInstance.RunPsTest(_logger, "Test-AppTypeVersion");
53+
}
54+
55+
[Fact]
56+
[Trait(Category.AcceptanceType, Category.CheckIn)]
57+
public void TestApp()
58+
{
59+
TestController.NewInstance.RunPsTest(_logger, "Test-App");
60+
}
61+
62+
[Fact]
63+
[Trait(Category.AcceptanceType, Category.CheckIn)]
64+
public void TestService()
65+
{
66+
TestController.NewInstance.RunPsTest(_logger, "Test-Service");
67+
}
68+
}
69+
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
$clusterName = Get-ClusterName
16+
$resourceGroupName = Get-ResourceGroupName
17+
$appTypeName = Get-AppTypeName
18+
$v1 = Get-AppTypeV1Name
19+
$v2 = Get-AppTypeV2Name
20+
$packageV1 = Get-AppPackageV1
21+
$packageV2 = Get-AppPackageV2
22+
$serviceTypeName = Get-ServiceTypeName
23+
24+
function Test-AppType
25+
{
26+
$appType = Get-AzServiceFabricApplicationType -ResourceGroupName $resourceGroupName -ClusterName $clusterName
27+
Assert-Null $appType
28+
29+
$appType = New-AzServiceFabricApplicationType -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName -Verbose
30+
Assert-AreEqual "Succeeded" $appType.ProvisioningState
31+
32+
$appTypeFromGet = Get-AzServiceFabricApplicationType -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName
33+
Assert-NotNull $appTypeFromGet
34+
Assert-AreEqual $appType.Id $appTypeFromGet.Id
35+
36+
$removeResponse = Remove-AzServiceFabricApplicationType -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName -Force -PassThru -Verbose
37+
Assert-True { $removeResponse }
38+
39+
Assert-ThrowsContains { Get-AzServiceFabricApplicationType -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName } "NotFound"
40+
}
41+
42+
function Test-AppTypeVersion
43+
{
44+
$appTypeVersion = Get-AzServiceFabricApplicationTypeVersion -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName
45+
Assert-Null $appTypeVersion
46+
47+
$appTypeVersion = New-AzServiceFabricApplicationTypeVersion -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName -Version $v1 -PackageUrl $packageV1 -Verbose
48+
Assert-AreEqual "Succeeded" $appTypeVersion.ProvisioningState
49+
50+
$appTypeVersionFromGet = Get-AzServiceFabricApplicationTypeVersion -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName -Version $v1
51+
Assert-NotNull $appTypeVersionFromGet
52+
Assert-AreEqual $appTypeVersion.Id $appTypeVersionFromGet.Id
53+
54+
$removeResponse = Remove-AzServiceFabricApplicationTypeVersion -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName -Version $v1 -Force -PassThru -Verbose
55+
Assert-True { $removeResponse }
56+
57+
$removeResponse = Remove-AzServiceFabricApplicationType -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName -Force -PassThru -Verbose
58+
Assert-True { $removeResponse }
59+
60+
Assert-ThrowsContains { Get-AzServiceFabricApplicationTypeVersion -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName -Version $v1 } "NotFound"
61+
}
62+
63+
function Test-App
64+
{
65+
$appName = getAssetName "testApp"
66+
$serviceName = getAssetName "testService"
67+
$serviceName = "$($appName)~$($serviceName)"
68+
69+
$app = Get-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName
70+
Assert-Null $app
71+
72+
$app = New-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationTypeName $appTypeName -ApplicationTypeVersion $v1 -Name $appName -PackageUrl $packageV1 -Verbose
73+
Assert-AreEqual "Succeeded" $app.ProvisioningState
74+
75+
$appFromGet = Get-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName
76+
Assert-NotNull $appFromGet
77+
Assert-AreEqual $app.Id $appFromGet.Id
78+
79+
$service = New-AzServiceFabricService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Stateless -InstanceCount -1 -ApplicationName $appName -Name $serviceName -Type $serviceTypeName -PartitionSchemeSingleton -Verbose
80+
Assert-AreEqual "Succeeded" $service.ProvisioningState
81+
82+
$appTypeVersion = New-AzServiceFabricApplicationTypeVersion -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName -Version $v2 -PackageUrl $packageV2 -Verbose
83+
Assert-AreEqual "Succeeded" $appTypeVersion.ProvisioningState
84+
85+
$app = Update-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName -ApplicationTypeVersion $v2 `
86+
-ApplicationParameter @{Mode="decimal"} -HealthCheckStableDurationSec 0 -HealthCheckWaitDurationSec 0 -HealthCheckRetryTimeoutSec 0 `
87+
-UpgradeDomainTimeoutSec 5000 -UpgradeTimeoutSec 7000 -FailureAction Rollback -UpgradeReplicaSetCheckTimeoutSec 300 -ForceRestart -Verbose
88+
Assert-AreEqual "Succeeded" $app.ProvisioningState
89+
Assert-AreEqual $v2 $app.TypeVersion
90+
Assert-AreEqual "decimal" $app.Parameters["Mode"]
91+
Assert-True { $app.UpgradePolicy.ForceRestart }
92+
Assert-AreEqual "00:05:00" $app.UpgradePolicy.UpgradeReplicaSetCheckTimeout
93+
Assert-AreEqual "01:56:40" $app.UpgradePolicy.RollingUpgradeMonitoringPolicy.UpgradeTimeout
94+
Assert-AreEqual "01:23:20" $app.UpgradePolicy.RollingUpgradeMonitoringPolicy.UpgradeDomainTimeout
95+
Assert-AreEqual "Rollback" $app.UpgradePolicy.RollingUpgradeMonitoringPolicy.FailureAction
96+
97+
$app = Update-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName -MinimumNodeCount 1 -MaximumNodeCount 4 -Verbose
98+
Assert-AreEqual 1 $app.MinimumNodes
99+
Assert-AreEqual 4 $app.MaximumNodes
100+
101+
$removeResponse = Remove-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName -Force -PassThru -Verbose
102+
Assert-True { $removeResponse }
103+
104+
$removeResponse = Remove-AzServiceFabricApplicationType -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName -Force -PassThru -Verbose
105+
Assert-True { $removeResponse }
106+
107+
Assert-ThrowsContains { Get-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName } "NotFound"
108+
}
109+
110+
function Test-Service
111+
{
112+
$appName = getAssetName "testApp"
113+
$serviceName = getAssetName "testService"
114+
$serviceName = "$($appName)~$($serviceName)"
115+
116+
$app = New-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationTypeName $appTypeName -ApplicationTypeVersion $v1 -Name $appName -PackageUrl $packageV1 -Verbose
117+
Assert-AreEqual "Succeeded" $app.ProvisioningState
118+
119+
$service = Get-AzServiceFabricService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationName $appName
120+
Assert-Null $service
121+
122+
$service = New-AzServiceFabricService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Stateless -InstanceCount -1 -ApplicationName $appName -Name $serviceName -Type $serviceTypeName -PartitionSchemeSingleton -Verbose
123+
Assert-AreEqual "Succeeded" $service.ProvisioningState
124+
125+
$serviceFromGet = Get-AzServiceFabricService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationName $appName -Name $serviceName
126+
Assert-NotNull $serviceFromGet
127+
Assert-AreEqual $service.Id $serviceFromGet.Id
128+
129+
$removeResponse = Remove-AzServiceFabricService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationName $appName -Name $serviceName -Force -PassThru -Verbose
130+
Assert-True { $removeResponse }
131+
132+
$removeRespoetnse = Remove-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName -Force -PassThru -Verbose
133+
Assert-True { $removeResponse }
134+
135+
$removeResponse = Remove-AzServiceFabricApplicationType -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appTypeName -Force -PassThru -Verbose
136+
Assert-True { $removeResponse }
137+
138+
Assert-ThrowsContains { Get-AzServiceFabricService -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationName $appName -Name $serviceName } "NotFound"
139+
}

src/ServiceFabric/ServiceFabric.Test/ScenarioTests/TestServiceFabric.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public TestServiceFabric(ITestOutputHelper output)
4040
ServiceFabricCmdletBase.RunningTest = true;
4141
ServiceFabricCmdletBase.NewCreatedKeyVaultWaitTimeInSec = 0;
4242
//change the thumbprint in the common.ps1 file as well
43-
ServiceFabricCmdletBase.TestThumbprint = "C20BE98DB1592F7505E24AD92DE072649D691987";
43+
ServiceFabricCmdletBase.TestThumbprint = "910AC565E683987971F34531A824284E3B936040";
4444
ServiceFabricCmdletBase.TestCommonNameCACert = "azurermsfcntest.southcentralus.cloudapp.azure.com";
4545
ServiceFabricCmdletBase.TestCommonNameAppCert = "AzureRMSFTestCertApp";
46-
ServiceFabricCmdletBase.TestThumbprintAppCert = "656AD4B7774A1EAC0AE6C7561B0B2A05154B16B2";
46+
ServiceFabricCmdletBase.TestThumbprintAppCert = "EE28AF31B2741B52311A00F78DFF4F46240BB4F8";
4747
ServiceFabricCmdletBase.TestAppCert = false;
4848
}
4949

src/ServiceFabric/ServiceFabric.Test/ServiceFabric.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.1" />
1515
<PackageReference Include="Microsoft.Azure.KeyVault.WebKey" Version="3.0.1" />
16-
<PackageReference Include="Microsoft.Azure.Management.ServiceFabric" Version="1.1.1" />
16+
<PackageReference Include="Microsoft.Azure.Management.ServiceFabric" Version="1.2.0" />
1717
</ItemGroup>
1818

1919
<ItemGroup>

0 commit comments

Comments
 (0)