Skip to content

Commit 84e7420

Browse files
committed
Add ContainerService tests
1 parent f0cf827 commit 84e7420

File tree

5 files changed

+7332
-0
lines changed

5 files changed

+7332
-0
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
<Compile Include="ScenarioTests\AddVhdTests.cs" />
169169
<Compile Include="ScenarioTests\AEMExtensionTests.cs" />
170170
<Compile Include="ScenarioTests\ComputeCloudExceptionTests.cs" />
171+
<Compile Include="ScenarioTests\ContainerServiceTests.cs" />
171172
<Compile Include="ScenarioTests\DiagnosticsExtensionTests.cs" />
172173
<Compile Include="ScenarioTests\DscExtensionTests.cs" />
173174
<Compile Include="ScenarioTests\RunnerTests.cs" />
@@ -234,6 +235,9 @@
234235
<None Include="ScenarioTests\ComputeCloudExceptionTests.ps1">
235236
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
236237
</None>
238+
<None Include="ScenarioTests\ContainerServiceTests.ps1">
239+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
240+
</None>
237241
<None Include="ScenarioTests\DscExtensionTests.ps1">
238242
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
239243
</None>
@@ -296,6 +300,12 @@
296300
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.ComputeCloudExceptionTests\RunComputeCloudExceptionTests.json">
297301
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
298302
</None>
303+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.ContainerServiceTests\TestContainerService.json">
304+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
305+
</None>
306+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.ContainerServiceTests\TestContainerServiceUpdate.json">
307+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
308+
</None>
299309
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.DiagnosticsExtensionTests\TestDiagnosticsExtensionBasic.json">
300310
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
301311
</None>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
18+
namespace Microsoft.Azure.Commands.Compute.Test.ScenarioTests
19+
{
20+
public partial class ContainerServiceTests
21+
{
22+
[Fact]
23+
[Trait(Category.AcceptanceType, Category.CheckIn)]
24+
public void TestContainerService()
25+
{
26+
ComputeTestController.NewInstance.RunPsTest("Test-ContainerService");
27+
}
28+
29+
[Fact]
30+
[Trait(Category.AcceptanceType, Category.CheckIn)]
31+
public void TestContainerServiceUpdate()
32+
{
33+
ComputeTestController.NewInstance.RunPsTest("Test-ContainerServiceUpdate");
34+
}
35+
}
36+
}
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
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+
<#
16+
.SYNOPSIS
17+
Test Container Service
18+
19+
PS C:\> Get-Command *VMSS* | ft Name,Version,ModuleName
20+
21+
Name Version ModuleName
22+
---- ------- ----------
23+
24+
#>
25+
26+
<#
27+
.SYNOPSIS
28+
Test Virtual Machine Scale Set
29+
#>
30+
function Test-ContainerService
31+
{
32+
# Setup
33+
$rgname = Get-ComputeTestResourceName
34+
35+
try
36+
{
37+
# Common
38+
$loc = 'australiasoutheast';
39+
New-AzureRMResourceGroup -Name $rgname -Location $loc -Force;
40+
41+
42+
$csName = 'cs' + $rgname;
43+
$masterDnsPrefixName = 'master' + $rgname;
44+
$agentPoolDnsPrefixName = 'ap' + $rgname;
45+
$agentPoolProfileName = 'AgentPool1';
46+
$vmSize = 'Standard_A1';
47+
48+
$orchestratorType = 'DCOS';
49+
$adminUserName = 'acsLinuxAdmin';
50+
$sshPublicKey =
51+
"MIIDszCCApugAwIBAgIJALBV9YJCF/tAMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV" +
52+
"BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX" +
53+
"aWRnaXRzIFB0eSBMdGQwHhcNMTUwMzIyMjI1NDQ5WhcNMTYwMzIxMjI1NDQ5WjBF" +
54+
"MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50" +
55+
"ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIDANBgkqhkiG9w0BAQEFAAOCAQ0AMIIB" +
56+
"CAKCAQEAxDC+OfmB+tQ+P1MLmuuW2hJLdcK8m4DLgAk5l8bQDNBcVezt+bt/ZFMs" +
57+
"CHBhfTZG9O9yqMn8IRUh7/7jfQm6DmXCgtxj/uFiwT+F3out5uWvMV9SjFYvu9kJ" +
58+
"NXiDC2u3l4lHV8eHde6SbKiZB9Jji9FYQV4YiWrBa91j9I3hZzbTL0UCiJ+1PPoL" +
59+
"Rx/T1s9KT5Wn8m/z2EDrHWpetYu45OA7nzyIFOyQup5oWadWNnpk6HkCGutl9t9b" +
60+
"cLdjXjXPm9wcy1yxIB3Dj/Y8Hnulr80GJlUtUboDm8TExGc4YaPJxdn0u5igo5gZ" +
61+
"c6qnqH/BMd1nsyICx6AZnKBXBycoSQIBI6OBpzCBpDAdBgNVHQ4EFgQUzWhrCCDs" +
62+
"ClANCGlKZ64rHp2BDn0wdQYDVR0jBG4wbIAUzWhrCCDsClANCGlKZ64rHp2BDn2h" +
63+
"SaRHMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQK" +
64+
"ExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGSCCQCwVfWCQhf7QDAMBgNVHRMEBTAD" +
65+
"AQH/MA0GCSqGSIb3DQEBBQUAA4IBAQCUaJnX0aBzwBkbJrBS5YvkZnNKLdc4oHgC" +
66+
"/Nsr/9pwXzFYYXkdqpTw2nygH0C0WuPVVrG3Y3EGx/UIGDtLbwMvZJhQN9mZH3oX" +
67+
"+c3HGqBnXGuDRrtsfsK1ywAofx9amZfKNk/04/Rt3POdbyD1/AOADw2zMokbIapX" +
68+
"+nMDUtD/Tew9+0qU9+dcFMrFE1N4utlrFHlrLFbiCA/eSegP6gOeu9mqZv7UHIz2" +
69+
"oe6IQTw7zJF7xuBIzTYwjOCM197GKW7xc4GU4JZIN+faZ7njl/fxfUNdlqvgZUUn" +
70+
"kfdrzU3PZPl0w9NuncgEje/PZ+YtZvIsnH7MLSPeIGNQwW6V2kc8";
71+
72+
#$container = New-AzureRmContainerServiceConfig -Location $loc `
73+
# -OrchestratorProfileOrchestratorType $orchestratorType `
74+
# -MasterProfileDnsPrefix $masterDnsPrefixName `
75+
# -AdminUsername $adminUserName `
76+
# -Ssh $sshPublicKey;
77+
78+
#$container = Add-AzureRmContainerServiceAgentPoolProfile -ContainerService $container `
79+
# -Name $agentPoolProfileName `
80+
# -VmSize $vmSize `
81+
# -DnsPrefix $agentPoolDnsPrefixName;
82+
83+
#$st = New-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName -ContainerService $container;
84+
85+
86+
$container = New-AzureRmContainerServiceConfig -Location $loc -OrchestratorProfileOrchestratorType $orchestratorType `
87+
-MasterProfileDnsPrefix $masterDnsPrefixName -AdminUsername $adminUserName -Ssh $sshPublicKey `
88+
| Add-AzureRmContainerServiceAgentPoolProfile -Name $agentPoolProfileName -VmSize $vmSize -DnsPrefix $agentPoolDnsPrefixName `
89+
| New-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName;
90+
91+
92+
$cs = Get-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName;
93+
94+
$cslist = Get-AzureRmContainerService -ResourceGroupName $rgname;
95+
96+
$st = Remove-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName;
97+
}
98+
finally
99+
{
100+
# Cleanup
101+
Clean-ResourceGroup $rgname
102+
}
103+
}
104+
105+
<#
106+
.SYNOPSIS
107+
Test Virtual Machine Scale Set
108+
#>
109+
function Test-ContainerServiceUpdate
110+
{
111+
# Setup
112+
$rgname = Get-ComputeTestResourceName
113+
114+
try
115+
{
116+
# Common
117+
$loc = 'australiasoutheast';
118+
New-AzureRMResourceGroup -Name $rgname -Location $loc -Force;
119+
120+
121+
$csName = 'cs' + $rgname;
122+
$masterDnsPrefixName = 'master' + $rgname;
123+
$agentPoolDnsPrefixName = 'ap' + $rgname;
124+
$agentPoolProfileName = 'AgentPool1';
125+
$vmSize = 'Standard_A1';
126+
127+
$orchestratorType = 'DCOS';
128+
$adminUserName = 'acsLinuxAdmin';
129+
$sshPublicKey =
130+
"MIIDszCCApugAwIBAgIJALBV9YJCF/tAMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV" +
131+
"BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHw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RrtsfsK1ywAofx9amZfKNk/04/Rt3POdbyD1/AOADw2zMokbIapX" +
147+
"+nMDUtD/Tew9+0qU9+dcFMrFE1N4utlrFHlrLFbiCA/eSegP6gOeu9mqZv7UHIz2" +
148+
"oe6IQTw7zJF7xuBIzTYwjOCM197GKW7xc4GU4JZIN+faZ7njl/fxfUNdlqvgZUUn" +
149+
"kfdrzU3PZPl0w9NuncgEje/PZ+YtZvIsnH7MLSPeIGNQwW6V2kc8";
150+
151+
#$container = New-AzureRmContainerServiceConfig -Location $loc `
152+
# -OrchestratorProfileOrchestratorType $orchestratorType `
153+
# -MasterProfileDnsPrefix $masterDnsPrefixName `
154+
# -AdminUsername $adminUserName `
155+
# -Ssh $sshPublicKey;
156+
157+
#$container = Add-AzureRmContainerServiceAgentPoolProfile -ContainerService $container `
158+
# -Name $agentPoolProfileName `
159+
# -VmSize $vmSize `
160+
# -DnsPrefix $agentPoolDnsPrefixName;
161+
162+
#$st = New-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName -ContainerService $container;
163+
164+
165+
$container = New-AzureRmContainerServiceConfig -Location $loc `
166+
-OrchestratorProfileOrchestratorType $orchestratorType `
167+
-MasterProfileDnsPrefix $masterDnsPrefixName `
168+
-MasterProfileCount 1 `
169+
-AdminUsername $adminUserName `
170+
-Ssh $sshPublicKey `
171+
| Add-AzureRmContainerServiceAgentPoolProfile -Name $agentPoolProfileName `
172+
-VmSize $vmSize `
173+
-DnsPrefix $agentPoolDnsPrefixName `
174+
-Count 1 `
175+
| New-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName;
176+
177+
178+
179+
180+
Get-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName `
181+
| Remove-AzureRmContainerServiceAgentPoolProfile -Name $agentPoolProfileName `
182+
| Add-AzureRmContainerServiceAgentPoolProfile -Name $agentPoolProfileName `
183+
-VmSize $vmSize `
184+
-DnsPrefix $agentPoolDnsPrefixName `
185+
-Count 2 `
186+
| Update-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName;
187+
188+
#$cs = Get-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName;
189+
190+
#$cs = Remove-AzureRmContainerServiceAgentPoolProfile -Name $agentPoolProfileName -ContainerService $cs;
191+
192+
#$cs = Add-AzureRmContainerServiceAgentPoolProfile -Name $agentPoolProfileName `
193+
# -VmSize $vmSize `
194+
# -DnsPrefix $agentPoolDnsPrefixName `
195+
# -Count 2 `
196+
# -ContainerService $cs;
197+
198+
#$st = Update-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName -ContainerService $cs;
199+
200+
$cs = Get-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName;
201+
202+
$st = Remove-AzureRmContainerService -ResourceGroupName $rgname -ContainerServiceName $csName;
203+
}
204+
finally
205+
{
206+
# Cleanup
207+
Clean-ResourceGroup $rgname
208+
}
209+
}
210+

0 commit comments

Comments
 (0)