Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ConfigurationData = @{
- AllNodes = @(
- @{
- NodeName = 'sql-01'
- Roles = @{
- Computer = @{
- MachineName = 'sql-01'
- DomainName = 'example.com'
- Credential = 'Svc-Domain-Join@example.com'
- }
- }
- }
- )
- Credentials = @{
- 'Svc-Domain-Join@example.com' = (Join-Path -Path $PSScriptRoot -ChildPath 'ConfigDataPester.clixml')
- }
- }
- # Mimic special variables in PSDSC configurations
- $AllNodes = $ConfigurationData.AllNodes
- Describe 'Structural Tests' {
- It 'Defines credential files' {
- $ConfigurationData.Keys -icontains 'Credentials' | Should Be $true
- }
- foreach ($CredName in $ConfigurationData.Credentials.Keys) {
- It "Defines existing credential file for $CredName" {
- Test-Path -Path $ConfigurationData.Credentials.$CredName | Should Be $true
- }
- }
- }
- # Mimic special variable $Node in enumeration
- foreach ($Node in $ConfigurationData.AllNodes) {
- Describe "Node $($Node.NodeName)" {
- Context 'Role computer' {
- It 'Contains computer role' {
- $Node.Roles.Keys -icontains 'Computer' | Should Be $true
- }
- It 'Resolves credential object if specified' {
- if ($Node.Roles.Computer.Keys -icontains 'Credential') {
- $ConfigurationData.Credentials.Keys -icontains $Node.Roles.Computer.Credential | Should Be $true
- }
- }
- It 'Specifies credentials for domain join' {
- $Node.Roles.Computer.Keys -icontains 'DomainName' | Should Be $true
- $Node.Roles.Computer.Keys -icontains 'Credential' | Should Be $true
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement