Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package/Deploy-Exchange2019.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@
14 = -FollowAfter without step 21
Console : EXM_ICONS = Emoji | Symbols | Ascii forces the icon style; NO_COLOR removes the colours.
Documentation : Docs\Exchange2019Migration-Guide.html (or .md). History: CHANGELOG.md

Disclaimer:
This Script is a Personal project.
It's provided "AS-IS". It's not an official Microsoft product so no support can be expected from Microsoft.

As any scripts you must read carefully the documentation and test it first in a Test environment before any run in Production.
#>

[CmdletBinding(DefaultParameterSetName='Standard')]
Expand Down
6 changes: 6 additions & 0 deletions package/Manage-IISLogs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@

No external dependency: Compress-Archive (PS5+), Get-ChildItem, Remove-Item.
The script writes its own log to $LogPath\ManageIISLogs_<date>.txt

Disclaimer:
This Script is a Personal project.
It's provided "AS-IS". It's not an official Microsoft product so no support can be expected from Microsoft.

As any scripts you must read carefully the documentation and test it first in a Test environment before any run in Production.
#>

[CmdletBinding(DefaultParameterSetName = 'Run')]
Expand Down
9 changes: 8 additions & 1 deletion package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,11 @@ notepad .\Configs\DiskLayout.csv ; notepad .\Configs\DAGInfo.csv

Project page, releases and change log: https://github.com/Nico77600/Exchange2013-2016-to-2019-Migration

License: [MIT](LICENSE).
License: [MIT](LICENSE).

## Disclaimer

This Script is a Personal project.
It's provided "AS-IS". It's not an official Microsoft product so no support can be expected from Microsoft.

As any scripts you must read carefully the documentation and test it first in a Test environment before any run in Production.
42 changes: 42 additions & 0 deletions tests/Exchange2019Migration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,44 @@ BeforeAll {
}
}

Describe 'Runtime disclaimer' {
BeforeAll {
$script:DisclaimerRepo = Split-Path $PSScriptRoot -Parent
$script:DisclaimerConfig = Get-Content (Join-Path $script:DisclaimerRepo '.github\ci.json') -Raw | ConvertFrom-Json
$script:DisclaimerRuntime = Join-Path $script:DisclaimerRepo $script:DisclaimerConfig.runtimeRoot
$script:DisclaimerPattern = '(?ms)^## Disclaimer[ \t]*\r?\n(?<Body>.*?)(?=^##[ \t]|\z)'
$rootReadme = [IO.File]::ReadAllText((Join-Path $script:DisclaimerRepo 'README.md'))
$matches = [regex]::Matches($rootReadme, $script:DisclaimerPattern)
if ($matches.Count -ne 1) { throw 'The root README must contain exactly one canonical disclaimer.' }
$script:CanonicalDisclaimer = $matches[0].Groups['Body'].Value.Trim().Replace("`r`n", "`n")
function ConvertTo-DisclaimerParagraphs([string]$Text) {
(($Text.Trim() -split '\r?\n[ \t]*\r?\n') | ForEach-Object { ($_ -replace '\s+', ' ').Trim() }) -join "`n`n"
}
}

It 'keeps the runtime README disclaimer identical to the canonical root section' {
$readme = [IO.File]::ReadAllText((Join-Path $script:DisclaimerRuntime 'README.md'))
$matches = [regex]::Matches($readme, $script:DisclaimerPattern)
$matches.Count | Should -Be 1
$matches[0].Groups['Body'].Value.Trim().Replace("`r`n", "`n") | Should -BeExactly $script:CanonicalDisclaimer
}

It 'keeps both delivered public entry script disclaimers attached to their help with the same wording and paragraphs' {
foreach ($entry in $script:DisclaimerConfig.packageEntry, 'Manage-IISLogs.ps1') {
$path = Join-Path $script:DisclaimerRuntime $entry
$errors = $null
$ast = [Management.Automation.Language.Parser]::ParseFile($path, [ref]$null, [ref]$errors)
@($errors).Count | Should -Be 0 -Because $entry
$help = $ast.GetHelpContent()
$help | Should -Not -BeNullOrEmpty -Because $entry
$notes = $help.Notes
[regex]::Matches($notes, '(?m)^[ \t]*Disclaimer:[ \t]*$').Count | Should -Be 1 -Because $entry
$body = [regex]::Match($notes, '(?s)(?:^|\r?\n)[ \t]*Disclaimer:[ \t]*\r?\n(?<Body>.*)\z').Groups['Body'].Value
(ConvertTo-DisclaimerParagraphs $body) | Should -BeExactly (ConvertTo-DisclaimerParagraphs $script:CanonicalDisclaimer) -Because $entry
}
}
}

Describe 'Files' {
It 'parse in Windows PowerShell 5.1, the shell of the framework' {
$list = Join-Path $TestDrive 'files.txt'
Expand Down Expand Up @@ -230,6 +268,10 @@ Describe 'Package' {
$LASTEXITCODE | Should -Be 0
Test-Path (Join-Path $destination 'Deploy-Exchange2019.ps1') | Should -BeTrue
Test-Path (Join-Path $destination 'Docs\Exchange2019Migration-Guide.html') | Should -BeTrue
$readme = Join-Path $destination 'README.md'
Test-Path $readme | Should -BeTrue
(Get-FileHash -LiteralPath $readme -Algorithm SHA256).Hash |
Should -BeExactly (Get-FileHash -LiteralPath (Join-Path $script:PackageRoot 'README.md') -Algorithm SHA256).Hash
foreach ($name in 'Reports', 'tools', 'tests') { Test-Path (Join-Path $destination $name) | Should -BeFalse }
$config = Import-PowerShellDataFile (Join-Path $destination 'Configs\Deployment.config.psd1')
$config.LicenseKey | Should -BeNullOrEmpty
Expand Down
4 changes: 2 additions & 2 deletions tools/New-MigrationPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
The package contains only what Deploy-Exchange2019.ps1 needs at run time, plus the HTML guides:
Deploy-Exchange2019.ps1, Manage-IISLogs.ps1, Modules\, Steps\, Configs\,
Docs\Exchange2019Migration-UserGuide.html, Docs\Exchange2019Migration-Guide.html,
CHANGELOG.md, LICENSE
README.md, CHANGELOG.md, LICENSE
It never copies Reports\ (run output: server, database and mailbox names), tools\ or tests\.

Environment values:
Expand Down Expand Up @@ -62,7 +62,7 @@ if (Test-Path -LiteralPath $Destination) {

# ---- Files needed at run time ---------------------------------------------------------------------
$files = New-Object System.Collections.Generic.List[string]
foreach ($f in 'Deploy-Exchange2019.ps1', 'Manage-IISLogs.ps1', 'CHANGELOG.md', 'LICENSE', 'Configs\HealthChecker.ps1', 'Docs\Exchange2019Migration-UserGuide.html', 'Docs\Exchange2019Migration-Guide.html') { $files.Add($f) }
foreach ($f in 'Deploy-Exchange2019.ps1', 'Manage-IISLogs.ps1', 'README.md', 'CHANGELOG.md', 'LICENSE', 'Configs\HealthChecker.ps1', 'Docs\Exchange2019Migration-UserGuide.html', 'Docs\Exchange2019Migration-Guide.html') { $files.Add($f) }
foreach ($folder in 'Modules', 'Steps') {
Get-ChildItem -LiteralPath (Join-Path $packageRoot $folder) -File | ForEach-Object { $files.Add($_.FullName.Substring(([IO.Path]::GetFullPath($packageRoot).TrimEnd('\') + '\').Length)) }
}
Expand Down
Loading