|
1 | | -# PowerUpSQL Pester Tests |
| 1 | +# PowerUpSQL Pester Tests - Baseline Tests |
2 | 2 |
|
3 | 3 | ###################################################### |
4 | 4 | # |
@@ -242,22 +242,52 @@ Describe "Get-SQLConnectionTestThreaded" { |
242 | 242 | ###################################################### |
243 | 243 |
|
244 | 244 | <# |
245 | | -Get-SQLColumnSampleDataThreaded |
246 | 245 | Get-SQLAuditDatabaseSpec |
247 | 246 | Get-SQLAuditServerSpec |
248 | 247 | Get-SQLServerCredential |
249 | 248 | Get-SQLServerLink |
250 | 249 | Get-SQLServerLogin |
251 | 250 | Get-SQLServerPriv |
252 | 251 | Get-SQLServerRole |
253 | | -Get-SQLServerRoleMember |
254 | | -Get-SQLServiceAccount |
255 | | -Get-SQLServiceLocal |
| 252 | +Get-SQLServerRoleMember |
256 | 253 | Get-SQLStoredProcedure |
257 | 254 | Get-SQLTriggerDdl |
258 | 255 | Get-SQLTriggerDml |
259 | 256 | #> |
260 | 257 |
|
| 258 | +# Get-SQLServiceLocal |
| 259 | +Describe "Get-SQLServiceLocal" { |
| 260 | + It "Should return results for the local host with query" { |
| 261 | + if ( (Get-SQLServiceLocal | Measure-Object).count -lt 1) { |
| 262 | + Throw "Incorrect service information results returned" |
| 263 | + } |
| 264 | + } |
| 265 | +} |
| 266 | + |
| 267 | +# Get-SQLServiceAccount |
| 268 | +Describe "Get-SQLServiceAccount" { |
| 269 | + It "Should return results for the local host with query" { |
| 270 | + if ( (Get-SQLServiceAccount | Measure-Object).count -lt 1) { |
| 271 | + Throw "Incorrect service information results returned" |
| 272 | + } |
| 273 | + } |
| 274 | + It "Should accept -Instance argument" { |
| 275 | + if ( (Get-SQLServiceAccount -Instance $env:COMPUTERNAME | Measure-Object).count -lt 1) { |
| 276 | + Throw "Incorrect service information results returned" |
| 277 | + } |
| 278 | + } |
| 279 | + It "Should accept -Username and -Password arguments" { |
| 280 | + if ( (Get-SQLServiceAccount -Instance $env:COMPUTERNAME -Username test -Password test | Measure-Object).count -lt 1) { |
| 281 | + Throw "Incorrect service information results returned" |
| 282 | + } |
| 283 | + } |
| 284 | + It "Should accept pipeline input" { |
| 285 | + if ( ( Get-SQLInstanceLocal | Get-SQLServiceAccount | Measure-Object).count -lt 1) { |
| 286 | + Throw "Incorrect service information results returned" |
| 287 | + } |
| 288 | + } |
| 289 | +} |
| 290 | + |
261 | 291 | # Get-SQLServerInfo |
262 | 292 | Describe "Get-SQLServerInfo" { |
263 | 293 | It "Should return results for the local host with query" { |
@@ -534,6 +564,46 @@ Describe "Get-SQLColumnSampleData" { |
534 | 564 | } |
535 | 565 | } |
536 | 566 |
|
| 567 | +# Get-SQLColumnSampleDataThreaded |
| 568 | +Describe "Get-SQLColumnSampleDataThreaded" { |
| 569 | + It "Should return results for the local host" { |
| 570 | + if ( (Get-SQLColumnSampleDataThreaded | Measure-Object).count -lt 1) { |
| 571 | + Throw "Incorrect threaded column search & sample data results returned" |
| 572 | + } |
| 573 | + } |
| 574 | + It "Should accept -Instance argument" { |
| 575 | + if ( (Get-SQLColumnSampleDataThreaded -Instance $env:COMPUTERNAME | Measure-Object).count -lt 1) { |
| 576 | + Throw "Incorrect threaded column search & sample data results returned" |
| 577 | + } |
| 578 | + } |
| 579 | + It "Should accept -Username and -Password arguments" { |
| 580 | + if ( (Get-SQLColumnSampleDataThreaded -Instance $env:COMPUTERNAME -Username test -Password test -Keywords "statu" | Measure-Object).count -lt 1) { |
| 581 | + Throw "Incorrect threaded column search & sample data results returned" |
| 582 | + } |
| 583 | + } |
| 584 | + It "Should accept -Keywords argument" { |
| 585 | + if ( (Get-SQLColumnSampleDataThreaded -Instance $env:COMPUTERNAME -Keywords "statu" | Measure-Object).count -lt 1) { |
| 586 | + Throw "Incorrect threaded column search & sample data results returned" |
| 587 | + } |
| 588 | + } |
| 589 | + It "Should accept -SampleSize argument" { |
| 590 | + if ( (Get-SQLColumnSampleDataThreaded -Instance $env:COMPUTERNAME -Keywords "statu" -SampleSize 2 | Measure-Object).count -lt 1) { |
| 591 | + Throw "Incorrect threaded column search & sample data results returned" |
| 592 | + } |
| 593 | + } |
| 594 | + It "Should accept -DatabaseName argument" { |
| 595 | + if ( (Get-SQLColumnSampleDataThreaded -Instance $env:COMPUTERNAME -Keywords "statu" -DatabaseName "master" | Measure-Object).count -lt 1) { |
| 596 | + Throw "Incorrect threaded column search & sample data results returned" |
| 597 | + } |
| 598 | + } |
| 599 | + |
| 600 | + It "Should accept pipeline input" { |
| 601 | + if ( ( Get-SQLInstanceLocal | Get-SQLColumnSampleDataThreaded -Keywords "statu" | Measure-Object).count -lt 1) { |
| 602 | + Throw "Incorrect threaded column search & sample data results returned" |
| 603 | + } |
| 604 | + } |
| 605 | +} |
| 606 | + |
537 | 607 | # Get-SQLDatabase |
538 | 608 | Describe "Get-SQLDatabase" { |
539 | 609 | It "Should return results for the local host" { |
|
0 commit comments