Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into IntuneAssignmentGrou…
Browse files Browse the repository at this point in the history
…pDisplayName
  • Loading branch information
William-Francillette committed Feb 27, 2024
2 parents 6511193 + 655f471 commit 7592599
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 24 deletions.
41 changes: 24 additions & 17 deletions .vscode/GetTestCoverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,38 @@
param(
[Parameter(Mandatory = $true)]
[string]
$UnitTestFilePath,

[Parameter(Mandatory = $true)]
[string]
$CmdletModule = (Join-Path -Path $PSScriptRoot `
-ChildPath '..\Stubs\Microsoft365.psm1' `
-Resolve)
$UnitTestFilePath
)

if ($UnitTestFilePath.EndsWith('Tests.ps1'))
{
$moduleName = 'Pester'
$minVersion = '5.5.0'

$pesterParameters = @{
Path = $unitTestFilePath
Parameters = @{
CmdletModule = $CmdletModule
}
}
$module = Get-Module -ListAvailable | Where-Object { $_.Name -eq $moduleName -and $_.Version -ge $minVersion }

if ($module -ne $null)
{
Write-Output "Module $moduleName with version greater than or equal to $minVersion found."
}
else
{
Write-Output "Module $moduleName with version greater than or equal to $minVersion not found."
Write-Output 'Please install the module using the following command:'
Write-Output "Install-Module -Name $moduleName -MinimumVersion $minVersion"
return
}

if ($UnitTestFilePath.EndsWith('Tests.ps1'))
{
$unitTest = Get-Item -Path $UnitTestFilePath
$unitTestName = "$($unitTest.Name.Split('.')[1])"

$unitTestFilePath = (Join-Path -Path $PSScriptRoot `
$coveragePath = (Join-Path -Path $PSScriptRoot `
-ChildPath "..\Modules\Microsoft365DSC\DSCResources\MSFT_$($unitTestName)\MSFT_$($unitTestName).psm1" `
-Resolve)

Invoke-Pester -Script $pesterParameters -CodeCoverage $UnitTestFilePath -Verbose
$config = New-PesterConfiguration
$config.Run.Path = $UnitTestFilePath
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.Path = $coveragePath
Invoke-Pester -Configuration $config
}
23 changes: 18 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"request": "launch",
"name": "Run current unit test",
"script": "${file}",
"args": [
"${workspaceRoot}/Tests/Unit/Stubs/Microsoft365.psm1"
],
"args": [],
"cwd": "${file}",
"createTemporaryIntegratedConsole": true
},
Expand All @@ -18,10 +16,25 @@
"name": "Get current unit test code overage",
"script": "${workspaceRoot}/.vscode/GetTestCoverage.ps1",
"args": [
"${file}",
"${workspaceRoot}/Tests/Unit/Stubs/Microsoft365.psm1"
"${file}"
],
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "Run all QA tests",
"script": "Import-Module '${workspaceRoot}/Tests/TestHarness.psm1'; $QaResults = Invoke-QualityChecksHarness ",
"args": [],
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "Run all Unit Tests",
"script": "Import-Module '${workspaceRoot}/Tests/TestHarness.psm1'; $UnitResults = Invoke-TestHarness",
"args": [],
"createTemporaryIntegratedConsole": true
}
]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
FIXES [#3962](https://github.com/microsoft/Microsoft365DSC/issues/3962)
* SPOAccessControlSettings
* Added support for the ConditionalAccessPolicy parameter based on the PNP Module
* TeamsCallQueue
* Reduce the number of Calls for Export using new cache pattern
FIXES [[#4191](https://github.com/microsoft/Microsoft365DSC/issues/4192)]
* TeamsGuestMeetingConfiguration
* Added the missing parameter AllowTranscription.
FIXES [#4363](https://github.com/microsoft/Microsoft365DSC/issues/4363)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,18 @@ function Get-TargetResource
$nullReturn.Ensure = 'Absent'
try
{
$queue = Get-CsCallQueue -NameFilter $Name `
-ErrorAction SilentlyContinue | Where-Object -FilterScript {$_.Name -eq $Name}
if (-not $Script:ExportMode)
{
Write-Host -Message "Getting Office 365 queue $Name"
$queue = Get-CsCallQueue -NameFilter $Name `
-ErrorAction SilentlyContinue | Where-Object -FilterScript {$_.Name -eq $Name}
}
else
{
Write-Host -Message "Retrieving queue $Name from the exported instances"
$queue = $Script:exportedInstances | Where-Object -FilterScript {$_.Name -eq $Name}
}


if ($null -eq $queue)
{
Expand Down

0 comments on commit 7592599

Please sign in to comment.