Skip to content

Commit 5ba017f

Browse files
committed
Add tests
1 parent da33639 commit 5ba017f

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/Compute/Compute.Test/ScenarioTests/DiskRPTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,11 @@ public void TestDiskCreateImportSecure()
206206
TestRunner.RunTestScript("Test-ConfVMImportSecure");
207207
}
208208

209+
[Fact]
210+
[Trait(Category.AcceptanceType, Category.LiveOnly)]
211+
public void TestDiskSupportedSecurityOption()
212+
{
213+
TestRunner.RunTestScript("Test-SupportedSecurityOption");
214+
}
209215
}
210216
}

src/Compute/Compute.Test/ScenarioTests/DiskRPTests.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,3 +1905,36 @@ function Test-ConfVMImportSecure
19051905
Clean-ResourceGroup $rgname;
19061906
}
19071907
}
1908+
1909+
<#
1910+
.SYNOPSIS
1911+
Test SupportedSecurityOption Parameter during creation of managed disk using CreateOption of Import
1912+
#>
1913+
function Test-SupportedSecurityOption
1914+
{
1915+
$rgname = Get-ComputeTestResourceName;
1916+
$loc = "eastus2euap";
1917+
1918+
try{
1919+
New-AzResourceGroup -Name $rgname -Location $loc -Force;
1920+
$sourceUri = "https://teststorage.blob.core.windows.net/vhds/test.vhd"
1921+
$subId = Get-SubscriptionIdFromResourceGroup $rgname;
1922+
$storageAccountId = "/subscriptions/$subId/resourceGroups/$rgname/providers/Microsoft.Storage/storageAccounts/teststorage"
1923+
1924+
$diskConfig = New-AzDiskConfig -Location $loc -AccountType 'Premium_LRS' -CreateOption Import -SourceUri $sourceUri -StorageAccountId $storageAccountId -SupportedSecurityOption "TrustedLaunchSupported"
1925+
$diskname = "disk" + $rgname;
1926+
New-AzDisk -ResourceGroupName $rgname -DiskName $diskname -Disk $diskConfig;
1927+
$disk = Get-AzDisk -ResourceGroupName $rgname -DiskName $diskname;
1928+
Assert-AreEqual $disk.SupportedSecurityOption "TrustedLaunchSupported";
1929+
1930+
$updateconfig = New-AzDiskUpdateConfig -SupportedSecurityOption "TrustedLaunchAndConfidentialVMSupported";
1931+
$disk = Update-AzDisk -ResourceGroupName $rgname -DiskName $diskname -DiskUpdate $updateconfig;
1932+
Assert-AreEqual $disk.SupportedSecurityOption "TrustedLaunchAndConfidentialVMSupported";
1933+
}
1934+
1935+
finally
1936+
{
1937+
# Cleanup
1938+
Clean-ResourceGroup $rgname
1939+
}
1940+
}

0 commit comments

Comments
 (0)