<commit_before>Describe "[$($Lab.Name)] DC Generic" -Tag RootDC, DC, FirstChildDC {

    Context "Role deployment successful" {
        It "[RootDC] Should return the correct amount of machines" {
            (Get-LabVM -Role ADDS).Count | Should -Be $(Get-Lab).Machines.Where( { $_.Roles.Name -contains 'RootDC' -or $_.Roles.Name -contains 'DC' -or $_.Roles.Name -contains 'FirstChildDC' }).Count
        }

        foreach ($vm in (Get-LabVM -Role ADDS))
        {
            It "$vm should have ADWS running" -TestCases @{vm = $vm } {
        
                Invoke-LabCommand -ComputerName $vm -ScriptBlock {
                    (Get-Service -Name ADWS).Status.ToString()
                } -PassThru -NoDisplay | Should -Be Running
            }
        }
        
        foreach ($vm in (Get-LabVM -Role ADDS))
        {
            It "$vm should respond to ADWS calls" -TestCases @{vm = $vm } {
            
                { Invoke-LabCommand -ComputerName $vm -ScriptBlock { Get-ADUser -Identity $env:USERNAME } -PassThru -NoDisplay } | Should -Not -Throw
            }
        }
    }
}

Describe "[$($Lab.Name)] RootDC specific" -Tag RootDC {
    
    foreach ($vm in (Get-LabVM -Role RootDC))
    {
        It "$(Get-LabVM -Role RootDC) should hold PDC emulator FSMO role" -TestCases @{vm = $vm } {
        
            Invoke-LabCommand -ComputerName $vm -ScriptBlock { (Get-ADDomain).PDCEmulator } -PassThru -NoDisplay | Should -Be $vm.FQDN
        }
    }
}

<commit_msg>Compatibility for ancient server versions<commit_after>Describe "[$($Lab.Name)] DC Generic" -Tag RootDC, DC, FirstChildDC {

    Context "Role deployment successful" {
        It "[RootDC] Should return the correct amount of machines" {
            (Get-LabVM -Role ADDS).Count | Should -Be $(Get-Lab).Machines.Where( { $_.Roles.Name -contains 'RootDC' -or $_.Roles.Name -contains 'DC' -or $_.Roles.Name -contains 'FirstChildDC' }).Count
        }

        foreach ($vm in (Get-LabVM -Role ADDS))
        {
            It "$vm should have ADWS running" -TestCases @{vm = $vm } {
        
                Invoke-LabCommand -ComputerName $vm -ScriptBlock {
                    (Get-Service -Name ADWS).Status.ToString()
                } -PassThru -NoDisplay | Should -Be Running
            }
        }
        
        foreach ($vm in (Get-LabVM -Role ADDS))
        {
            It "$vm should respond to ADWS calls" -TestCases @{vm = $vm } {
            
                { Invoke-LabCommand -ComputerName $vm -ScriptBlock { Import-Module ActiveDirectory; Get-ADUser -Identity $env:USERNAME } -PassThru -NoDisplay } | Should -Not -Throw
            }
        }
    }
}

Describe "[$($Lab.Name)] RootDC specific" -Tag RootDC {
    
    foreach ($vm in (Get-LabVM -Role RootDC))
    {
        It "$(Get-LabVM -Role RootDC) should hold PDC emulator FSMO role" -TestCases @{vm = $vm } {
        
            Invoke-LabCommand -ComputerName $vm -ScriptBlock { Import-Module ActiveDirectory; (Get-ADDomain).PDCEmulator } -PassThru -NoDisplay | Should -Be $vm.FQDN
        }
    }
}


{'fraction_non_alphanumeric': 0.12646675358539766, 'fraction_numerical': 0.0, 'mean_word_length': 1.9256434699714013, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '668022', 'n_tokens_mistral': 976, 'n_tokens_neox': 928, 'n_words': 266}