internal/tests/FailoverNode.tests.ps1

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

    foreach ($vm in (Get-LabVM -Role FailoverNode))
    {
        It "[$vm] Should be part of a cluster" -TestCases @{vm = $vm } {
            Invoke-LabCommand -ComputerName $vm -ScriptBlock { Get-Cluster -ErrorAction SilentlyContinue } -NoDisplay -PassThru | Should -Not -BeNullOrEmpty
        }
    }
}