Skip to content

Commit

Permalink
(maint) - moves unit tests to /tests/unit dir
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbreen28 committed Feb 8, 2024
1 parent d0b6ce2 commit febead6
Show file tree
Hide file tree
Showing 47 changed files with 982 additions and 44 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ jobs:
$ErrorActionPreference = "Stop"
$ResultsPath = "${{ matrix.results_file }}"
$TestPath = @(
(Resolve-Path .\src\Puppet.Dsc\functions)
(Resolve-Path .\src\Puppet.Dsc\internal\functions)
(Resolve-Path .\src\Puppet.Dsc\tests\Unit)
(Resolve-Path .\src\Puppet.Dsc\tests\general)
)
$Results = .\scripts\invoke_tests.ps1 -TestPath $TestPath -ResultsPath $ResultsPath -Tag ${{ matrix.tag }}
Expand Down
939 changes: 939 additions & 0 deletions Puppet.Dsc

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Add-DscResourceModule' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')

Mock New-Item -Verifiable
Mock Save-Module -Verifiable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Add-PuppetReferenceDocumentation' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope Puppet.Dsc {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Describe 'ConvertFrom-VersionBuild' -Tag 'Unit' {
BeforeAll {
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'ConvertTo-CanonicalPuppetAuthorName' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}
Context 'Basic verification' {
It 'lower-cases author name' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Describe 'ConvertTo-CanonicalPuppetAuthorName' -Tag 'Unit' {
$ModuleRootPath = Split-Path -Parent $PSCommandPath |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'ConvertTo-CanonicalPuppetAuthorName' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Describe 'ConvertTo-StandardizedVersionString' -Tag 'Unit' {
BeforeAll {
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'ConvertTo-UnescapedJson' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}
Context 'Basic verification' {
It 'Converts the object to JSON without unicode escapes' {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Describe 'ConvertTo-VersionBuild' -Tag 'Unit' {
BeforeAll {
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Describe 'Export-PuppetModule' -Tag 'Unit' {
}

BeforeAll {
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-CimClassPropertiesList' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Describe 'Get-DscResourceImplementation' -Tag 'Unit' {
BeforeAll {
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')

# The using statement will fail without a correct module path;
# The scriptblock in Start-Job can't see the Pester TestDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-DscResourceParameterInfo' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'When the AST can be parsed for functions' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Describe 'Get-DscResourceParameterInfoByCimClass' -Skip:(!$RunningElevated) -Tag
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope Puppet.Dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-DscResourceTypeInformation' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-EmbeddedCimInstance' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope Puppet.Dsc {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Describe 'Get-ForgeModuleInfo' -Tag 'Unit' {
BeforeAll {
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'functions')).Replace('.Tests.ps1', '.ps1')

Function New-ModuleInfo {
Param(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Describe 'Get-LatestBuild' -Tag 'Unit' {
}

BeforeAll {
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope Puppet.Dsc {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Describe 'Get-PowerShellDscModule' -Tag 'Unit' {
BeforeAll {
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-ProviderContent' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope Puppet.Dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-PuppetDataType' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope Puppet.Dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-PuppetModuleVersion' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Describe 'Get-PuppetizedModuleName' -Tag 'Unit' {
$ModuleRootPath = Split-Path -Parent $PSCommandPath |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-ReadmeContent' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope Puppet.Dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-ShortType' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic functionality' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-TypeContent' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope Puppet.Dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Get-TypeParameterContent' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope Puppet.Dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Initialize-DscResourceCimClass' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'basic functionality' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Initialize-PuppetModule' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Invoke-PdkCommand' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Describe 'New-PuppetDscModule' -Tag 'Unit' {
$ModuleRootPath = Split-Path -Parent $PSCommandPath |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Out-Utf8File' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Set-PSModulePath' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Describe 'Update-PuppetModuleMetadata' -Tag 'Unit' {
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
}
BeforeAll {
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Test-DscResourcePropertyParameterStatus' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Test-EmbeddedInstance' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Test-RunningElevated' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Test-SymLinkedItem' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

Context 'Basic verification' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'UpdatePuppetModuleChangelog' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope Puppet.Dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Update-PuppetModuleFixture' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Update-PuppetModuleMetadata' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe 'Update-PuppetModuleReadme' -Tag 'Unit' {
Split-Path -Parent |
Split-Path -Parent
Import-Module "$ModuleRootPath/Puppet.Dsc.psd1"
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
. ($PSCommandPath.Replace('tests\Unit', 'internal\functions')).Replace('.Tests.ps1', '.ps1')
}

InModuleScope puppet.dsc {
Expand Down

0 comments on commit febead6

Please sign in to comment.