Skip to content
Merged
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
15 changes: 15 additions & 0 deletions tests/Find-DbaCommand.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ Describe $CommandName -Tag UnitTests {
}

Describe $CommandName -Tag IntegrationTests {
BeforeAll {
# The -Rebuild test regenerates bin\dbatools-index.json in place. When the module runs from
# a git working copy, that overwrites a tracked release asset and leaves the tree modified
# after every run. Back the file up and restore it, so the rebuild is still exercised for
# real but leaves no trace.
$indexFile = Join-Path (Get-Module $ModuleName).ModuleBase "bin\dbatools-index.json"
$indexBackup = "$($TestConfig.Temp)\$CommandName-$(Get-Random)-index.json"
Copy-Item -Path $indexFile -Destination $indexBackup
}

AfterAll {
Copy-Item -Path $indexBackup -Destination $indexFile -ErrorAction SilentlyContinue
Remove-Item -Path $indexBackup -ErrorAction SilentlyContinue
}

Context "Command finds jobs using all parameters" {
It "Should find more than 5 snapshot commands" {
$results = @(Find-DbaCommand -Pattern "snapshot")
Expand Down