Skip to content

Commit

Permalink
start job outside of the beforeall (do Find-DbaAgent)
Browse files Browse the repository at this point in the history
  • Loading branch information
niphlod committed Jul 30, 2024
1 parent 893d92a commit 3e5dbb5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/Find-DbaAgentJob.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" {
BeforeAll {
$null = New-DbaAgentJob -SqlInstance $script:instance2 -Job 'dbatoolsci_testjob' -OwnerLogin 'sa'
$null = New-DbaAgentJobStep -SqlInstance $script:instance2 -Job 'dbatoolsci_testjob' -StepId 1 -StepName 'dbatoolsci Failed' -Subsystem TransactSql -SubsystemServer $script:instance2 -Command "RAISERROR (15600,-1,-1, 'dbatools_error');" -CmdExecSuccessCode 0 -OnSuccessAction QuitWithSuccess -OnFailAction QuitWithFailure -Database master -RetryAttempts 1 -RetryInterval 2
#$null = Start-DbaAgentJob -SqlInstance $script:instance2 -Job 'dbatoolsci_testjob'
$null = New-DbaAgentJobCategory -SqlInstance $script:instance2 -Category 'dbatoolsci_job_category' -CategoryType LocalJob
$null = New-DbaAgentJob -SqlInstance $script:instance2 -Job 'dbatoolsci_testjob_disabled' -Category 'dbatoolsci_job_category' -Disabled
$null = New-DbaAgentJobStep -SqlInstance $script:instance2 -Job 'dbatoolsci_testjob_disabled' -StepId 1 -StepName 'dbatoolsci Test Step' -Subsystem TransactSql -SubsystemServer $script:instance2 -Command 'SELECT * FROM master.sys.all_columns' -CmdExecSuccessCode 0 -OnSuccessAction QuitWithSuccess -OnFailAction QuitWithFailure -Database master -RetryAttempts 1 -RetryInterval 2
Expand Down Expand Up @@ -80,6 +79,8 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" {
It "Should find jobs that are owned by sa" {
$results | Should not be null
}
$null = Start-DbaAgentJob -SqlInstance $script:instance2 -Job 'dbatoolsci_testjob'
Start-Sleep 5
$results = Find-DbaAgentJob -SqlInstance $script:instance2 -IsFailed -Since '2016-07-01 10:47:00'
It "Should find jobs that have been failed since July of 2016" {
$results | Should not be null
Expand Down

0 comments on commit 3e5dbb5

Please sign in to comment.