From 8408fcd430eb9f7444d9db3d231e36f424110d41 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Sat, 18 Jul 2020 16:24:35 -0700 Subject: [PATCH] Minor UT fixes --- Tests/GitHubGists.tests.ps1 | 5 ++++- Tests/GitHubRepositories.tests.ps1 | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) 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 5ea84b12..b75ec08a 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -1363,6 +1363,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 } @@ -1402,6 +1407,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 }