New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database.Test - Unused Indexes #586

Open
valstrubhar opened this Issue Dec 11, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@valstrubhar
Copy link

valstrubhar commented Dec 11, 2018

Per the dbatools.io site the name of the command should be 'Find-DbaDBUnusedIndex' and not 'Find-DbaUnusedIndex'

Describe "Unused Index" -Tags UnusedIndex, $filename {
if ($NotContactable -contains $psitem) {
Context "Testing Unused indexes on $psitem" {
It "Can't Connect to $Psitem" {
$false | Should -BeTrue -Because "The instance should be available to be connected to!"
}
}
}
else {
Context "Testing Unused indexes on $psitem" {
try {
@($results = Find-DbaUnusedIndex -SqlInstance $psitem -Database $Database -ExcludeDatabase $ExcludedDatabases -EnableException).ForEach{
It "$psitem on $($psitem.SQLInstance) should return 0 Unused indexes" {
@($results).Count | Should -Be 0 -Because "You should have indexes that are used"
}
}
}
catch {
It -Skip "$psitem on $($psitem.SQLInstance) should return 0 Unused indexes" {
@($results).Count | Should -Be 0 -Because "You should have indexes that are used"
}
}
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment