#Import the psd1 $ModuleName = 'PoshCore' $ModuleManifestName = "$ModuleName.psd1" $ModuleManifestPath = "$PSScriptRoot\..\$ModuleManifestName" Import-Module $ModuleManifestPath -Force -ErrorAction Stop <# Integration/Acceptance Testing for PoshCore-DevContainer.ps1 Invoke-Pester –Script @{'Path' = 'C:\Githubdata\poshcore\Tests\PoshCore-DevContainer.Tests.ps1';} Description: Run through all functinos and confirm data from core is as expected #> #################### Data to Compare with Output - BEGIN #################### #region <# This data should be updated by pulling the data from core using a known good version of poshcore Using the code found in Tools\PSOGenerationForPesterTests.ps1 This only needs to be done if the data has changed in core or you want to change the devices used for the tests. #> #First test cluster group (1919) $ClusterGroup1 = New-Object PSObject -Property @{ id = '1919' type = 'Basic Cluster' virtual = @(407898, 407894, 407893) nodes = @(560559, 560570) name = 'Cluster Group 1' } #Second test cluster group (4335) $ClusterGroup1 = New-Object PSObject -Property @{ id = '4335' type = 'Advanced Cluster' virtual = @(560589, 560588, 560571, 560591) nodes = @(560559, 560570) name = 'Win 2012 Cluster' } #endregion ##################### Data to Compare with Output - END ##################### #################### Pester Tests - BEGIN #################### #region Describe "Get-CoreClusterGroups" { It 'Returns multiple cluster groups for the account' { #counts the number of cluster groups returned $Test1 = Get-CoreClusterGroups -Account '1103359' $test1.count | should BeGreaterThan 1 } It 'Returns correct cluster group information for group 1' { #Compares the account_id in the pso to the ones returned from core. $Test2 = Get-CoreClusterGroups -Account '1103359' $TestGroup1 = $Test2 | Where-Object {$_.id -eq $ClusterGroup1.id} $($TestGroup1.id) | should be $ClusterGroup1.id $($TestGroup1.type) | should be $ClusterGroup1.type $($TestGroup1.name) | should be $ClusterGroup1.name $($TestGroup1.nodes.count) | should be $($ClusterGroup1.nodes.count) $($TestGroup1.virtual.count) | should be $($ClusterGroup1.virtual.count) } It 'Returns correct cluster group information for group 2' { #Compares the account_id in the pso to the ones returned from core. $Test3 = Get-CoreClusterGroups -Account '1103359' $TestGroup2 = $Test3 | Where-Object {$_.id -eq $ClusterGroup2.id} $($TestGroup2.id) | should be $ClusterGroup2.id $($TestGroup2.type) | should be $ClusterGroup2.type $($TestGroup2.name) | should be $ClusterGroup2.name $($TestGroup2.nodes.count) | should be $($ClusterGroup2.nodes.count) $($TestGroup2.virtual.count) | should be $($ClusterGroup2.virtual.count) } } #endregion ##################### Pester Tests - END ##################### #Log to appstats Try { Set-LogtoAppstats -FunctionID "PoshCore-DevContainer-Tests" -AppID "PoshCore" } Catch { Write-Warning "Failed to Log to Appstats, Error message: $($_.exception.message))" }