Skip to content

Commit 0258961

Browse files
authored
Added live test for desktop virtualization (#21074)
* Updated live test to use jobs for resource cleanup * Added live test for desktop virtualization and modified the debug script
1 parent 93d329c commit 0258961

File tree

4 files changed

+92
-3
lines changed

4 files changed

+92
-3
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
Invoke-LiveTestScenario -Name "Create a Windows virtual desktop" -Description "Test creating a Windows virtual desktop" -ScenarioScript `
2+
{
3+
param ($rg)
4+
5+
$rgName = $rg.ResourceGroupName
6+
$location = "westus"
7+
$poolName = New-LiveTestResourceName
8+
$poolFriName = New-LiveTestRandomName -Option AllLetters
9+
$groupName = New-LiveTestResourceName
10+
$groupFriName = New-LiveTestRandomName -Option AllLetters
11+
$appName = New-LiveTestResourceName
12+
$appFriName = New-LiveTestRandomName -Option AllLetters
13+
14+
$pool = New-AzWvdHostPool -ResourceGroupName $rgName -Name $poolName -Location $location -FriendlyName $poolFriName -HostPoolType 'Pooled' -LoadBalancerType 'DepthFirst' -PreferredAppGroupType 'RailApplications' -ExpirationTime (Get-Date).ToUniversalTime().AddDays(1) -MaxSessionLimit 5
15+
New-AzWvdApplicationGroup -ResourceGroupName $rgName -Name $groupName -Location $location -FriendlyName $groupFriName -HostPoolArmPath $pool.Id -ApplicationGroupType 'RemoteApp'
16+
New-AzWvdApplication -ResourceGroupName $rgName -Name $appName -GroupName $groupName -FriendlyName $appFriName -FilePath "C:\Windows\System32\mspaint.exe" -IconIndex 0 -IconPath "C:\Windows\System32\mspaint.exe" -CommandLineSetting Allow -ShowInPortal:$true
17+
18+
$actual = Get-AzWvdApplication -Name $appName -ResourceGroupName $rgName -GroupName $groupName
19+
Assert-NotNull $actual
20+
Assert-AreEqual "$groupName/$appName" $actual.Name
21+
Assert-AreEqual $appFriName $actual.FriendlyName
22+
Assert-True { $actual.FilePath -like "*mspaint*" }
23+
}
24+
25+
Invoke-LiveTestScenario -Name "Update a Windows virtual desktop" -Description "Test updating an existing Windows virtual desktop" -ScenarioScript `
26+
{
27+
param ($rg)
28+
29+
$rgName = $rg.ResourceGroupName
30+
$location = "westus"
31+
$poolName = New-LiveTestResourceName
32+
$poolFriName = New-LiveTestRandomName -Option AllLetters
33+
$groupName = New-LiveTestResourceName
34+
$groupFriName = New-LiveTestRandomName -Option AllLetters
35+
$appName = New-LiveTestResourceName
36+
$appFriName = New-LiveTestRandomName -Option AllLetters
37+
$appFriNameNew = New-LiveTestRandomName -Option AllLetters -MaxLength 9
38+
39+
$pool = New-AzWvdHostPool -ResourceGroupName $rgName -Name $poolName -Location $location -FriendlyName $poolFriName -HostPoolType 'Pooled' -LoadBalancerType 'DepthFirst' -PreferredAppGroupType 'RailApplications' -ExpirationTime (Get-Date).ToUniversalTime().AddDays(1) -MaxSessionLimit 5
40+
New-AzWvdApplicationGroup -ResourceGroupName $rgName -Name $groupName -Location $location -FriendlyName $groupFriName -HostPoolArmPath $pool.Id -ApplicationGroupType 'RemoteApp'
41+
New-AzWvdApplication -ResourceGroupName $rgName -Name $appName -GroupName $groupName -FriendlyName $appFriName -FilePath "C:\Windows\System32\mspaint.exe" -IconIndex 0 -IconPath "C:\Windows\System32\mspaint.exe" -CommandLineSetting Allow -ShowInPortal:$true
42+
43+
$app = Get-AzWvdApplication -Name $appName -ResourceGroupName $rgName -GroupName $groupName
44+
$app | Update-AzWvdApplication -FilePath 'C:\Windows\System32\WindowsPowerShell\v1. 0\powershell.exe'
45+
46+
Update-AzWvdApplication -Name $appName -ResourceGroupName $rgName -GroupName $groupName -FriendlyName $appFriNameNew
47+
48+
$actual = Get-AzWvdApplication -Name $appName -ResourceGroupName $rgName -GroupName $groupName
49+
Assert-NotNull $actual
50+
Assert-AreEqual "$groupName/$appName" $actual.Name
51+
Assert-AreEqual $appFriNameNew $actual.FriendlyName
52+
Assert-True { $actual.FilePath -like "*powershell*" }
53+
}
54+
55+
Invoke-LiveTestScenario -Name "Delete a Windows virtual desktop" -Description "Test deleting a Windows virtual desktop" -ScenarioScript `
56+
{
57+
param ($rg)
58+
59+
$rgName = $rg.ResourceGroupName
60+
$location = "westus"
61+
$poolName = New-LiveTestResourceName
62+
$poolFriName = New-LiveTestRandomName -Option AllLetters
63+
$groupName = New-LiveTestResourceName
64+
$groupFriName = New-LiveTestRandomName -Option AllLetters
65+
$appName = New-LiveTestResourceName
66+
$appFriName = New-LiveTestRandomName -Option AllLetters
67+
68+
$pool = New-AzWvdHostPool -ResourceGroupName $rgName -Name $poolName -Location $location -FriendlyName $poolFriName -HostPoolType 'Pooled' -LoadBalancerType 'DepthFirst' -PreferredAppGroupType 'RailApplications' -ExpirationTime (Get-Date).ToUniversalTime().AddDays(1) -MaxSessionLimit 5
69+
New-AzWvdApplicationGroup -ResourceGroupName $rgName -Name $groupName -Location $location -FriendlyName $groupFriName -HostPoolArmPath $pool.Id -ApplicationGroupType 'RemoteApp'
70+
New-AzWvdApplication -ResourceGroupName $rgName -Name $appName -GroupName $groupName -FriendlyName $appFriName -FilePath "C:\Windows\System32\mspaint.exe" -IconIndex 0 -IconPath "C:\Windows\System32\mspaint.exe" -CommandLineSetting Allow -ShowInPortal:$true
71+
Remove-AzWvdApplication -ResourceGroupName $rgName -Name $appName -GroupName $groupName
72+
73+
$actual = Get-AzWvdApplication -Name $appName -ResourceGroupName $rgName -GroupName $groupName -ErrorAction SilentlyContinue
74+
Assert-Null $actual
75+
}

tools/TestFx/Live/DebugLocalLiveTestScenarios.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ function InvokeLocalLiveTestScenarios {
4747
. $_.FullName
4848
}
4949
}
50+
51+
Write-Host "##[section]Waiting for all cleanup jobs to be completed." -ForegroundColor Green
52+
while (Get-Job -State Running) {
53+
Write-Host "[section]Waiting for 10 seconds ..." -ForegroundColor Green
54+
Start-Sleep -Seconds 10
55+
}
56+
Write-Host "##[section]All cleanup jobs are completed." -ForegroundColor Green
57+
58+
Write-Host "##[group]Cleanup jobs information." -ForegroundColor Green
59+
$cleanupJobs = Get-Job
60+
$cleanupJobs | Select-Object Name, Command, State, PSBeginTime, PSEndTime, Output
61+
Write-Host "##[endgroup]"
62+
63+
$cleanupJobs | Remove-Job
5064
}
5165

5266
ImportLocalAzModules

tools/TestFx/Live/InvokeLiveTestScenarios.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ $liveScenarios | ForEach-Object {
9393

9494
Write-Host "##[section]Waiting for all cleanup jobs to be completed." -ForegroundColor Green
9595
while (Get-Job -State Running) {
96-
Write-Host "[section]Waiting for 10 seconds ..." -ForegroundColor Green
97-
Start-Sleep -Seconds 10
96+
Write-Host "[section]Waiting for 30 seconds ..." -ForegroundColor Green
97+
Start-Sleep -Seconds 30
9898
}
9999
Write-Host "##[section]All cleanup jobs are completed." -ForegroundColor Green
100100

tools/TestFx/Live/LiveTestUtility.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ function Clear-LiveTestResources {
388388
[string] $Name
389389
)
390390

391-
Invoke-LiveTestCommand -Command "Remove-AzResourceGroup -Name $Name -Force -AsJob"
391+
Invoke-LiveTestCommand -Command "Remove-AzResourceGroup -Name $Name -Force -AsJob | Out-Null"
392392
}
393393

394394
function ConvertToLiveTestJsonErrors {

0 commit comments

Comments
 (0)