internal/tests/AzDevOps.tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Describe "[$($Lab.Name)] AzDevOps" -Tag AzDevOps {
Context "Role deployment successful" {
        It "[AzDevOps] Should return the correct amount of machines" {
            (Get-LabVm -Role AzDevOps).Count | Should -Be $(Get-Lab).Machines.Where({$_.Roles.Name -contains 'AzDevOps'}).Count
        }

        foreach ($vm in (Get-LabVM -Role AzDevOps))
        {
            $role = $vm.Roles | Where-Object Name -eq AzDevOps            
            if ($role.Properties.ContainsKey('Organisation') -and $role.Properties.ContainsKey('PAT'))
            {
                continue
            }

            It "[$vm] Should have working AzDevOps Environment" -TestCases @{ 
                vm        = $vm
            } {
                $test = Test-LabTfsEnvironment -ComputerName $vm -NoDisplay -SkipWorker
                $test.ServerDeploymentOk | Should -Be $true
            }
        }
    }
}