internal/tests/Routing.tests.ps1

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

        foreach ($vm in (Get-LabVm -Role Routing))
        {
            It "[$vm] Should have Routing feature installed" -TestCases @{vm = $vm} {
                (Get-LabWindowsFeature -ComputerName $vm -FeatureName Routing, RSAT-RemoteAccess -NoDisplay).Installed | Should -Not -Contain $false
            }

            It "[$vm] Should be connected to the internet" -TestCases @{vm = $vm} {
                Test-LabMachineInternetConnectivity -ComputerName $vm
            }
        }
    }
}