Skip to content

Commit

Permalink
Corrected versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
ykuijs committed Nov 13, 2023
1 parent 2807c4f commit 7323010
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ModuleBuildTestRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ jobs:
with:
name: ${{ env.buildArtifactName }}
path: ${{ env.buildFolderName }}/
outputs:
ModuleVersion: ${{ steps.GitVersion.outputs.ModuleVersion }}

Test_Stage_test_windows_ps:
name: Windows (Windows PowerShell)
Expand All @@ -65,8 +63,6 @@ jobs:
- name: Run Tests
shell: powershell
run: './build.ps1 -Tasks Test'
env:
ModuleVersion: ${{ needs.Build_Stage_Package_Module.outputs.ModuleVersion }}
- name: Publish Test Artifact
uses: actions/upload-artifact@v3
with:
Expand Down
30 changes: 16 additions & 14 deletions tests/Unit/Public/New-CompositeResourceModule.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Describe New-CompositeResourceModule {
BeforeAll {
Mock -CommandName Write-Host -MockWith {} -ModuleName $dscModuleName

$testVersion = '1.23.1108.1'

function Test-IsPsCustomObject
{
[CmdletBinding()]
Expand Down Expand Up @@ -79,35 +81,35 @@ Describe New-CompositeResourceModule {
It 'Should return False because the Dependencies file does not exist' {
Mock -CommandName Test-Path -MockWith { return $false } -ModuleName $dscModuleName

New-CompositeResourceModule -OutputPath 'C:\Temp' -Version $env:ModuleVersion | Should -Be $false
New-CompositeResourceModule -OutputPath 'C:\Temp' -Version $testVersion | Should -Be $false
}

It 'Should return False because Microsoft365DSC cannot be found' {
Mock -CommandName Test-Path -MockWith { return $true } -ModuleName $dscModuleName
Mock -CommandName Get-Module -MockWith { } -ModuleName $dscModuleName

New-CompositeResourceModule -OutputPath 'C:\Temp' -Version $env:ModuleVersion | Should -Be $false
New-CompositeResourceModule -OutputPath 'C:\Temp' -Version $testVersion | Should -Be $false
}

}

Context 'Function succeeds, module is created correctly' {
BeforeAll {
Mock -CommandName Test-Path -MockWith { return $true } -ModuleName $dscModuleName
Mock -CommandName Get-Module -MockWith { return @(@{Name = 'Microsoft365DSC';Version = $env:ModuleVersion;Path = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion"}) } -ModuleName $dscModuleName
Mock -CommandName Get-Module -MockWith { return @(@{Name = 'Microsoft365DSC';Version = $testVersion;Path = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion"}) } -ModuleName $dscModuleName
Mock -CommandName Initialize-Module -MockWith {} -ModuleName $dscModuleName
Mock -CommandName Get-ChildItem -MockWith {
return @(
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion\DSCResources\MSFT_AADApplication\MSFT_AADApplication.schema.mof";Name = 'MSFT_AADApplication.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion\DSCResources\MSFT_EXOAcceptedDomain\MSFT_EXOAcceptedDomain.schema.mof";Name = 'MSFT_EXOAcceptedDomain.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion\DSCResources\MSFT_IntuneAntivirusPolicyWindows10SettingCatalog\MSFT_IntuneAntivirusPolicyWindows10SettingCatalog.schema.mof";Name = 'MSFT_IntuneAntivirusPolicyWindows10SettingCatalog.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion\DSCResources\MSFT_O365AdminAuditLogConfig\MSFT_O365AdminAuditLogConfig.schema.mof";Name = 'MSFT_O365AdminAuditLogConfig.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion\DSCResources\MSFT_ODSettings\MSFT_ODSettings.schema.mof";Name = 'MSFT_ODSettings.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion\DSCResources\MSFT_PlannerPlan\MSFT_PlannerPlan.schema.mof";Name = 'MSFT_PlannerPlan.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion\DSCResources\MSFT_PPTenantSettings\MSFT_PPTenantSettings.schema.mof";Name = 'MSFT_PPTenantSettings.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion\DSCResources\MSFT_SCAuditConfigurationPolicy\MSFT_SCAuditConfigurationPolicy.schema.mof";Name = 'MSFT_SCAuditConfigurationPolicy.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion\DSCResources\MSFT_SPOTenantSettings\MSFT_SPOTenantSettings.schema.mof";Name = 'MSFT_SPOTenantSettings.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$env:ModuleVersion\DSCResources\MSFT_TeamsClientConfiguration\MSFT_TeamsClientConfiguration.schema.mof";Name = 'MSFT_TeamsClientConfiguration.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion\DSCResources\MSFT_AADApplication\MSFT_AADApplication.schema.mof";Name = 'MSFT_AADApplication.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion\DSCResources\MSFT_EXOAcceptedDomain\MSFT_EXOAcceptedDomain.schema.mof";Name = 'MSFT_EXOAcceptedDomain.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion\DSCResources\MSFT_IntuneAntivirusPolicyWindows10SettingCatalog\MSFT_IntuneAntivirusPolicyWindows10SettingCatalog.schema.mof";Name = 'MSFT_IntuneAntivirusPolicyWindows10SettingCatalog.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion\DSCResources\MSFT_O365AdminAuditLogConfig\MSFT_O365AdminAuditLogConfig.schema.mof";Name = 'MSFT_O365AdminAuditLogConfig.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion\DSCResources\MSFT_ODSettings\MSFT_ODSettings.schema.mof";Name = 'MSFT_ODSettings.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion\DSCResources\MSFT_PlannerPlan\MSFT_PlannerPlan.schema.mof";Name = 'MSFT_PlannerPlan.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion\DSCResources\MSFT_PPTenantSettings\MSFT_PPTenantSettings.schema.mof";Name = 'MSFT_PPTenantSettings.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion\DSCResources\MSFT_SCAuditConfigurationPolicy\MSFT_SCAuditConfigurationPolicy.schema.mof";Name = 'MSFT_SCAuditConfigurationPolicy.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion\DSCResources\MSFT_SPOTenantSettings\MSFT_SPOTenantSettings.schema.mof";Name = 'MSFT_SPOTenantSettings.schema.mof' }
@{FullName = "C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\$testVersion\DSCResources\MSFT_TeamsClientConfiguration\MSFT_TeamsClientConfiguration.schema.mof";Name = 'MSFT_TeamsClientConfiguration.schema.mof' }
) } -ModuleName $dscModuleName
Mock -CommandName Get-MofSchemaObject -MockWith {
$allMofSchemas = . $PSScriptRoot\MofSchemas.ps1
Expand Down Expand Up @@ -176,7 +178,7 @@ Describe New-CompositeResourceModule {
}

It 'Should return True because the CR module is created successfully' {
New-CompositeResourceModule -OutputPath 'C:\Temp' -Version $env:ModuleVersion | Should -Be $true
New-CompositeResourceModule -OutputPath 'C:\Temp' -Version $testVersion | Should -Be $true
Should -Invoke -CommandName Save-Resource -Times 10 -ModuleName $dscModuleName
Should -Invoke -CommandName Set-Content -Times 1 -ModuleName $dscModuleName

Expand Down

0 comments on commit 7323010

Please sign in to comment.