Skip to content

Commit 2d2bd72

Browse files
author
nimisha
committed
Added tests without recording
1 parent c7e39ab commit 2d2bd72

File tree

5 files changed

+89
-0
lines changed

5 files changed

+89
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
<ItemGroup>
165165
<Compile Include="Common\ComputeTestController.cs" />
166166
<Compile Include="ScenarioTests\AddVhdTests.cs" />
167+
<Compile Include="ScenarioTests\ChefExtensionTests.cs" />
167168
<Compile Include="ScenarioTests\ComputeCloudExceptionTests.cs" />
168169
<Compile Include="ScenarioTests\DiagnosticsExtensionTests.cs" />
169170
<Compile Include="ScenarioTests\DscExtensionTests.cs" />
@@ -219,6 +220,7 @@
219220
<None Include="ScenarioTests\AddVhdTests.ps1">
220221
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
221222
</None>
223+
<None Include="ScenarioTests\ChefExtensionTests.ps1" />
222224
<None Include="ScenarioTests\ComputeCloudExceptionTests.ps1">
223225
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
224226
</None>
@@ -401,6 +403,8 @@
401403
<None Include="Templates\azuredeploy.json">
402404
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
403405
</None>
406+
<None Include="Templates\client.rb" />
407+
<None Include="Templates\tstorgnztn-validator.pem" />
404408
</ItemGroup>
405409
<ItemGroup>
406410
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
2+
using Xunit;
3+
4+
namespace Microsoft.Azure.Commands.Compute.Test.ScenarioTests
5+
{
6+
public class ChefExtensionTests
7+
{
8+
[Fact]
9+
[Trait(Category.AcceptanceType, Category.CheckIn)]
10+
public void TestChefExtensionBasic()
11+
{
12+
ComputeTestController.NewInstance.RunPsTest("Test-SetChefExtensionBasic");
13+
}
14+
}
15+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# ChefExtensionTests.ps1
3+
#
4+
5+
<#
6+
.SYNOPSIS
7+
Test the usage of the Set virtual machine chef extension command
8+
#>
9+
function Test-SetChefExtensionBasic
10+
{
11+
$rgname = Get-ComputeTestResourceName
12+
$loc = Get-ComputeVMLocation
13+
14+
try
15+
{
16+
# Create Virtual Machine
17+
$vm = Create-VirtualMachine -rgname $rgname -loc $loc
18+
$vmname = $vm.Name
19+
$version = "1210.12"
20+
$client_rb = ".\Templates\client.rb";
21+
$validationPemFile = ".\Templates\tstorgnztn-validator.pem";
22+
23+
# Set Chef extension
24+
Set-AzureRmVMChefExtension -ResourceGroupName $rgname -VMName $vmname -TypeHandlerVersion $version -ClientRb $client.rb -ValidationPem $validationPemFile -Windows
25+
$extension = Get-AzureRmVMExtension -ResourceGroupName $rgname -VMName $vmname -Name ChefClient
26+
27+
Assert-NotNull $extension
28+
Assert-AreEqual $extension.Publisher 'Chef.Bootstrap.WindowsAzure'
29+
Assert-AreEqual $extension.ExtensionType 'ChefClient'
30+
Assert-AreEqual $extension.Name 'ChefClient'
31+
$settings = $extension.PublicSettings | ConvertFrom-Json
32+
Assert-AreEqual $settings.autoUpdateClient "false"
33+
Assert-AreEqual $settings.deleteChefConfig "false"
34+
}
35+
finally
36+
{
37+
# Cleanup
38+
Clean-ResourceGroup $rgname
39+
}
40+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
log_level :debug
2+
chef_server_url "https://api.chef.io/organizations/tstorgnztn"
3+
validation_client_name "tstorgnztn-validator"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-----BEGIN RSA PRIVATE KEY-----
2+
MIIEpAIBAAKCAQEAuxOLMJhoDZXc2WsRGPjj6UTw67Q1l0qdm8Zd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