diff --git a/Tests/GitHubGists.tests.ps1 b/Tests/GitHubGists.tests.ps1 index bc59b974..67e06ccf 100644 --- a/Tests/GitHubGists.tests.ps1 +++ b/Tests/GitHubGists.tests.ps1 @@ -309,7 +309,10 @@ try } AfterAll { - Remove-Item -Path $tempPath -Recurse -ErrorAction SilentlyContinue -Force + if (Get-Variable -Name tempPath -ErrorAction SilentlyContinue) + { + Remove-Item -Path $tempPath -Recurse -ErrorAction SilentlyContinue -Force + } } Context 'Download gist content' { diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index eb4bc666..74599da4 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -1271,6 +1271,11 @@ try Describe 'GitHubRepositories\Disable-GitHubRepositoryVulnerabilityAlert' { BeforeAll { $repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) + + # The CI build has been unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + Enable-GitHubRepositoryVulnerabilityAlert -Uri $repo.svn_url } @@ -1306,6 +1311,11 @@ try Describe 'GitHubRepositories\Disable-GitHubRepositorySecurityFix' { BeforeAll { $repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) + + # The CI build has been unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + Enable-GitHubRepositorySecurityFix -Uri $repo.svn_url }