Streamline Tests and Builds

This commit is contained in:
Wes Carroll
2019-03-27 07:51:49 -04:00
parent 7da4588b9c
commit bbcbb4a970
3 changed files with 25 additions and 16 deletions
+12 -12
View File
@@ -1,6 +1,7 @@
$moduleName = "ZertoApiWrapper"
$moduleFileName = "ZertoApiWrapper.psm1"
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
$docsPath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests/Public', 'docs'
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
$modulePath = $filePath -replace "Public", ""
$userName = "zerto\build"
@@ -18,20 +19,19 @@ Describe "File Tests" {
Import-Module $modulePath\$moduleFileName
$commands = Get-Command -Module $moduleName | Select-Object -ExpandProperty Name
foreach ($command in $commands) {
$externalHelpFile = "{0}/{1}.md" -f $docsPath, $command
$path = "{0}/{1}.ps1" -f $filePath, $command
it "$command is backed by a file with the same name" {
$path | should exist
context "$command File Tests" {
it "$command is backed by a file with the same name" {
$path | should exist
}
it "$command has an external help file" {
$externalHelpFile | should exist
}
it "$command has the External Help File Defined" {
Get-Content -Path $path -First 1 | should be "<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>"
}
}
}
}
describe "External Help Defination Present" {
$publicFiles = Get-ChildItem "$filePath" -File
foreach ($file in $publicFiles) {
it "External Help File is Defined" {
Get-Content -Path $file.fullName -First 1 | should be "<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>"
}
}
}
Describe "Connection Tests"
+9
View File
@@ -21,3 +21,12 @@ task Analyze {
}
}
task FileTests {
Invoke-Pester "$BuildRoot\Tests\Public\ZertoApiWrapper.Tests.ps1"
}
task BuildPsd1 {
$functionsToExportPath = "{0}\ZertoApiWrapper\Public\" -f $MyInvocation.MyCommand.PSPath
$functionsToExport = (Get-ChildItem -Path $functionsToExportPath -File).name.Replace('.ps1', '')
$functionsToExport
}
+4 -4
View File
@@ -69,16 +69,16 @@
# NestedModules = @()
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = '*'
FunctionsToExport = 'Add-ZertoPeerSite', 'Checkpoint-ZertoVpg', 'Connect-ZertoServer', 'Disconnect-ZertoServer', 'Edit-ZertoVra', 'Export-ZertoVpg', 'Get-ZertoAlert', 'Get-ZertoDatastore', 'Get-ZertoEvent', 'Get-ZertoLicense', 'Get-ZertoLocalSite', 'Get-ZertoPeerSite', 'Get-ZertoProtectedVm', 'Get-ZertoRecoveryReport', 'Get-ZertoResourcesReport', 'Get-ZertoServiceProfile', 'Get-ZertoTask', 'Get-ZertoUnprotectedVm', 'Get-ZertoVirtualizationSite', 'Get-ZertoVolume', 'Get-ZertoVpg', 'Get-ZertoVpgSetting', 'Get-ZertoVra', 'Get-ZertoZorg', 'Get-ZertoZsspSession', 'Import-ZertoVpg', 'Install-ZertoVra', 'Invoke-ZertoFailover', 'Invoke-ZertoFailoverCommit', 'Invoke-ZertoFailoverRollback', 'Invoke-ZertoForceSync', 'Invoke-ZertoMove', 'Invoke-ZertoMoveCommit', 'Invoke-ZertoMoveRollback', 'New-ZertoVpg', 'New-ZertoVpgSettingsIdentifier', 'Remove-ZertoPeerSite', 'Remove-ZertoVpg', 'Resume-ZertoVpg', 'Save-ZertoVpgSettings', 'Set-ZertoAlert', 'Set-ZertoLicense', 'Start-ZertoCloneVpg', 'Start-ZertoFailoverTest', 'Stop-ZertoCloneVpg', 'Stop-ZertoFailoverTest', 'Suspend-ZertoVpg', 'Uninstall-ZertoVra'
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = '*'
CmdletsToExport = @()
# Variables to export from this module
VariablesToExport = '*'
VariablesToExport = @()
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = '*'
AliasesToExport = @()
# DSC resources to export from this module
# DscResourcesToExport = @()