From c81981015b35c9121c568ce1acc76e93adf6a9f0 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 16 Jul 2020 12:57:11 -0700 Subject: [PATCH 01/14] Attempting to increase reliability of some Pester tests We're seeing some inconsistent failures in some of the Pester tests. The hypothesis is that GitHub may need a little bit more time after the creation of objects before performing certain operations on them (like renaming repos), or may need more time after deleting them before it will successfully return a 404 on a successive Get request. To see if this is the case, I'm adding some 1 second sleeps at the point where we've seen test case failures in recent CI runs. --- Tests/GitHubProjects.tests.ps1 | 10 ++++++++++ Tests/GitHubRepositories.tests.ps1 | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Tests/GitHubProjects.tests.ps1 b/Tests/GitHubProjects.tests.ps1 index ccde85d6..59897080 100644 --- a/Tests/GitHubProjects.tests.ps1 +++ b/Tests/GitHubProjects.tests.ps1 @@ -611,6 +611,11 @@ try $project = New-GitHubProject -OwnerName $script:ownerName -RepositoryName $repo.name -ProjectName $defaultRepoProject -Description $defaultRepoProjectDesc $null = Remove-GitHubProject -Project $project.id -Confirm:$false It 'Project should be removed' { + # The CI build has beeen unreliable with this test. It's possible that GitHub + # needs a bit more time to update its databases after the removal before it will + # accurately return back a 404 on a Get-* immediately after a Remove-*. + Start-Sleep -Seconds 1 + {Get-GitHubProject -Project $project.id} | Should -Throw } } @@ -619,6 +624,11 @@ try $project = $repo | New-GitHubProject -ProjectName $defaultRepoProject -Description $defaultRepoProjectDesc $project | Remove-GitHubProject -Force It 'Project should be removed' { + # The CI build has beeen unreliable with this test. It's possible that GitHub + # needs a bit more time to update its databases after the removal before it will + # accurately return back a 404 on a Get-* immediately after a Remove-*. + Start-Sleep -Seconds 1 + {$project | Get-GitHubProject} | Should -Throw } } diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index 6fbcd27a..7e01138d 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -659,11 +659,23 @@ try It 'Should get no content using -Confirm:$false' { Remove-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name -Confirm:$false + + # The CI build has beeen unreliable with this test. It's possible that GitHub + # needs a bit more time to update its databases after the removal before it will + # accurately return back a 404 on a Get-* immediately after a Remove-*. + Start-Sleep -Seconds 1 + { Get-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name } | Should -Throw } It 'Should get no content using -Force' { Remove-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name -Force + + # The CI build has beeen unreliable with this test. It's possible that GitHub + # needs a bit more time to update its databases after the removal before it will + # accurately return back a 404 on a Get-* immediately after a Remove-*. + Start-Sleep -Seconds 1 + { Get-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name } | Should -Throw } } @@ -676,6 +688,11 @@ try $repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) -AutoInit $suffixToAddToRepo = "_renamed" $newRepoName = "$($repo.name)$suffixToAddToRepo" + + # The CI build has beeen unreliable with this test. It's possible that GitHub + # needs a bit more time to update its databases after the creation of a repo + # before it will consistently succeed when trying to rename it. + Start-Sleep -Seconds 1 } It "Should have the expected new repository name - by URI" { From 22704e112444a978444af886a7e2c58ecad4750f Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 16 Jul 2020 13:05:34 -0700 Subject: [PATCH 02/14] Adding another instance. --- Tests/GitHubRepositories.tests.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index 7e01138d..faedfcad 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -882,6 +882,12 @@ try It 'Should be removable by the pipeline' { ($repo | Remove-GitHubRepository -Confirm:$false) | Should -BeNullOrEmpty + + # The CI build has beeen unreliable with this test. It's possible that GitHub + # needs a bit more time to update its databases after the removal before it will + # accurately return back a 404 on a Get-* immediately after a Remove-*. + Start-Sleep -Seconds 1 + { $repo | Get-GitHubRepository } | Should -Throw } } @@ -917,6 +923,12 @@ try It 'Should be removable by the pipeline' { ($repo | Remove-GitHubRepository -Confirm:$false) | Should -BeNullOrEmpty + + # The CI build has beeen unreliable with this test. It's possible that GitHub + # needs a bit more time to update its databases after the removal before it will + # accurately return back a 404 on a Get-* immediately after a Remove-*. + Start-Sleep -Seconds 1 + { $repo | Get-GitHubRepository } | Should -Throw } } From f562ff707109194cb2c516d3af2ccf2c429a2ce6 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 16 Jul 2020 13:38:54 -0700 Subject: [PATCH 03/14] Adding another instance --- Tests/GitHubRepositories.tests.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index faedfcad..a410d71b 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -125,6 +125,8 @@ try IsTemplate = $true } $repo = New-GitHubRepository @newGitHubRepositoryParms + + Start-Sleep -Seconds 1 # To work around a delay that GitHub may have with generating the repo } It 'Should return an object of the correct type' { @@ -306,6 +308,8 @@ try } $templateRepo = New-GitHubRepository @newGitHubRepositoryParms + + Start-Sleep -Seconds 1 # To work around a delay that GitHub may have with generating the repo } Context 'When creating a public repository from a template' { From 0936968b87f08935cc70e90868abbd1c64a1c085 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 16 Jul 2020 15:16:36 -0700 Subject: [PATCH 04/14] More updates --- Tests/Common.ps1 | 4 ++ Tests/GitHubIssues.tests.ps1 | 9 ++++- Tests/GitHubLabels.tests.ps1 | 4 ++ Tests/GitHubProjects.tests.ps1 | 14 +++---- Tests/GitHubRepositories.tests.ps1 | 58 ++++++++++++++++----------- Tests/GitHubRepositoryForks.tests.ps1 | 4 +- 6 files changed, 59 insertions(+), 34 deletions(-) diff --git a/Tests/Common.ps1 b/Tests/Common.ps1 index 054eb7e8..ecf88b3a 100644 --- a/Tests/Common.ps1 +++ b/Tests/Common.ps1 @@ -100,6 +100,10 @@ function Initialize-CommonTestSetup Set-GitHubConfiguration -LogRequestBody # Make it easier to debug UT failures Set-GitHubConfiguration -MultiRequestProgressThreshold 0 # Status corrupts the raw CI logs for Linux and Mac, and makes runs take slightly longer. Set-GitHubConfiguration -DisableUpdateCheck # The update check is unnecessary during tests. + + # The number of seconds to sleep after performing some operations to ensure that successive + # API calls properly reflect previously updated state. + $script:defaultSleepSecondsForReliability = 1 } Initialize-CommonTestSetup diff --git a/Tests/GitHubIssues.tests.ps1 b/Tests/GitHubIssues.tests.ps1 index ed5c4d88..48a1d6b0 100644 --- a/Tests/GitHubIssues.tests.ps1 +++ b/Tests/GitHubIssues.tests.ps1 @@ -161,7 +161,9 @@ try for ($i = 0; $i -lt 4; $i++) { $newIssues += New-GitHubIssue -OwnerName $script:ownerName -RepositoryName $repo.name -Title ([Guid]::NewGuid().Guid) - Start-Sleep -Seconds 1 # Needed to ensure that there is a unique creation timestamp between issues + + # Needed to ensure that there is a unique creation timestamp between issues + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability } $newIssues[0] = Set-GitHubIssue -OwnerName $script:ownerName -RepositoryName $repo.name -Issue $newIssues[0].number -State Closed @@ -547,6 +549,11 @@ try } Lock-GitHubIssue -OwnerName $script:OwnerName -RepositoryName $repo.name -Issue $issue.number + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $timeline = @(Get-GitHubIssueTimeline -OwnerName $script:OwnerName -RepositoryName $repo.name -Issue $issue.number) It 'Should have an event now' { $timeline.Count | Should -Be 1 diff --git a/Tests/GitHubLabels.tests.ps1 b/Tests/GitHubLabels.tests.ps1 index 5c3a1e30..ceb8b3ff 100644 --- a/Tests/GitHubLabels.tests.ps1 +++ b/Tests/GitHubLabels.tests.ps1 @@ -81,6 +81,10 @@ try $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + Initialize-GitHubLabel -OwnerName $script:ownerName -RepositoryName $repositoryName -Label $defaultLabels } diff --git a/Tests/GitHubProjects.tests.ps1 b/Tests/GitHubProjects.tests.ps1 index 59897080..f4261a7b 100644 --- a/Tests/GitHubProjects.tests.ps1 +++ b/Tests/GitHubProjects.tests.ps1 @@ -611,10 +611,9 @@ try $project = New-GitHubProject -OwnerName $script:ownerName -RepositoryName $repo.name -ProjectName $defaultRepoProject -Description $defaultRepoProjectDesc $null = Remove-GitHubProject -Project $project.id -Confirm:$false It 'Project should be removed' { - # The CI build has beeen unreliable with this test. It's possible that GitHub - # needs a bit more time to update its databases after the removal before it will - # accurately return back a 404 on a Get-* immediately after a Remove-*. - Start-Sleep -Seconds 1 + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability {Get-GitHubProject -Project $project.id} | Should -Throw } @@ -624,10 +623,9 @@ try $project = $repo | New-GitHubProject -ProjectName $defaultRepoProject -Description $defaultRepoProjectDesc $project | Remove-GitHubProject -Force It 'Project should be removed' { - # The CI build has beeen unreliable with this test. It's possible that GitHub - # needs a bit more time to update its databases after the removal before it will - # accurately return back a 404 on a Get-* immediately after a Remove-*. - Start-Sleep -Seconds 1 + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability {$project | Get-GitHubProject} | Should -Throw } diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index a410d71b..e2c3c7ad 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -126,7 +126,9 @@ try } $repo = New-GitHubRepository @newGitHubRepositoryParms - Start-Sleep -Seconds 1 # To work around a delay that GitHub may have with generating the repo + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability } It 'Should return an object of the correct type' { @@ -309,7 +311,9 @@ try $templateRepo = New-GitHubRepository @newGitHubRepositoryParms - Start-Sleep -Seconds 1 # To work around a delay that GitHub may have with generating the repo + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability } Context 'When creating a public repository from a template' { @@ -325,7 +329,10 @@ try } $repo = New-GitHubRepositoryFromTemplate @newGitHubRepositoryFromTemplateParms - Start-Sleep -Seconds 1 # To work around a delay that GitHub may have with generating the repo + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability } It 'Should have the expected type and addititional properties' { @@ -366,7 +373,10 @@ try } $repo = $templateRepo | New-GitHubRepositoryFromTemplate @newGitHubRepositoryFromTemplateParms - Start-Sleep -Seconds 1 # To work around a delay that GitHub may have with generating the repo + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability } It 'Should have the expected type and addititional properties' { @@ -664,10 +674,9 @@ try It 'Should get no content using -Confirm:$false' { Remove-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name -Confirm:$false - # The CI build has beeen unreliable with this test. It's possible that GitHub - # needs a bit more time to update its databases after the removal before it will - # accurately return back a 404 on a Get-* immediately after a Remove-*. - Start-Sleep -Seconds 1 + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability { Get-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name } | Should -Throw } @@ -675,10 +684,9 @@ try It 'Should get no content using -Force' { Remove-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name -Force - # The CI build has beeen unreliable with this test. It's possible that GitHub - # needs a bit more time to update its databases after the removal before it will - # accurately return back a 404 on a Get-* immediately after a Remove-*. - Start-Sleep -Seconds 1 + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability { Get-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name } | Should -Throw } @@ -693,10 +701,9 @@ try $suffixToAddToRepo = "_renamed" $newRepoName = "$($repo.name)$suffixToAddToRepo" - # The CI build has beeen unreliable with this test. It's possible that GitHub - # needs a bit more time to update its databases after the creation of a repo - # before it will consistently succeed when trying to rename it. - Start-Sleep -Seconds 1 + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability } It "Should have the expected new repository name - by URI" { @@ -887,10 +894,9 @@ try It 'Should be removable by the pipeline' { ($repo | Remove-GitHubRepository -Confirm:$false) | Should -BeNullOrEmpty - # The CI build has beeen unreliable with this test. It's possible that GitHub - # needs a bit more time to update its databases after the removal before it will - # accurately return back a 404 on a Get-* immediately after a Remove-*. - Start-Sleep -Seconds 1 + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability { $repo | Get-GitHubRepository } | Should -Throw } @@ -928,10 +934,9 @@ try It 'Should be removable by the pipeline' { ($repo | Remove-GitHubRepository -Confirm:$false) | Should -BeNullOrEmpty - # The CI build has beeen unreliable with this test. It's possible that GitHub - # needs a bit more time to update its databases after the removal before it will - # accurately return back a 404 on a Get-* immediately after a Remove-*. - Start-Sleep -Seconds 1 + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability { $repo | Get-GitHubRepository } | Should -Throw } @@ -1003,6 +1008,11 @@ try Describe 'GitHubRepositories\Set-GitHubRepositoryTopic' { BeforeAll { $repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $topic = Set-GitHubRepositoryTopic -OwnerName $repo.owner.login -RepositoryName $repo.name -Name $defaultRepoTopic } diff --git a/Tests/GitHubRepositoryForks.tests.ps1 b/Tests/GitHubRepositoryForks.tests.ps1 index 7ea08eb1..cfc9aeb3 100644 --- a/Tests/GitHubRepositoryForks.tests.ps1 +++ b/Tests/GitHubRepositoryForks.tests.ps1 @@ -83,7 +83,9 @@ try } AfterAll { - Start-Sleep -Seconds 3 # Trying to avoid an issue with deleting the repo if it's still being created by GitHub + # Trying to avoid an issue with deleting the repo if it's still being created by GitHub + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $repo | Remove-GitHubRepository -Force } From 9cdc3f6755d4306b8bf65d71a60728ec96b02d7f Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 16 Jul 2020 16:04:45 -0700 Subject: [PATCH 05/14] More updates --- Tests/GitHubLabels.tests.ps1 | 20 ++++++++++++++++++++ Tests/GitHubRepositories.tests.ps1 | 15 +++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/Tests/GitHubLabels.tests.ps1 b/Tests/GitHubLabels.tests.ps1 index ceb8b3ff..899d543e 100644 --- a/Tests/GitHubLabels.tests.ps1 +++ b/Tests/GitHubLabels.tests.ps1 @@ -331,6 +331,11 @@ try Context 'Removing a label with parameters' { $label = $repo | New-GitHubLabel -Label 'test' -Color 'CCCCCC' + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + Remove-GitHubLabel -OwnerName $script:ownerName -RepositoryName $repositoryName -Label $label.name -Force It 'Should be gone after being removed by parameter' { @@ -340,6 +345,11 @@ try Context 'Removing a label with the repo on the pipeline' { $label = $repo | New-GitHubLabel -Label 'test' -Color 'CCCCCC' + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $repo | Remove-GitHubLabel -Label $label.name -Confirm:$false It 'Should be gone after being removed by parameter' { @@ -349,6 +359,11 @@ try Context 'Removing a label with the name on the pipeline' { $label = $repo | New-GitHubLabel -Label 'test' -Color 'CCCCCC' + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $label.name | Remove-GitHubLabel -OwnerName $script:ownerName -RepositoryName $repositoryName -Force It 'Should be gone after being removed by parameter' { @@ -358,6 +373,11 @@ try Context 'Removing a label with the label object on the pipeline' { $label = $repo | New-GitHubLabel -Label 'test' -Color 'CCCCCC' + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $label | Remove-GitHubLabel -Force It 'Should be gone after being removed by parameter' { diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index e2c3c7ad..b9e35150 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -708,16 +708,31 @@ try It "Should have the expected new repository name - by URI" { $renamedRepo = Rename-GitHubRepository -Uri ($repo.RepositoryUrl) -NewName $newRepoName -Force + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $renamedRepo.name | Should -Be $newRepoName } It "Should have the expected new repository name - by Elements" { $renamedRepo = Rename-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name -NewName $newRepoName -Confirm:$false + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $renamedRepo.name | Should -Be $newRepoName } It "Should work via the pipeline" { $renamedRepo = $repo | Rename-GitHubRepository -NewName $newRepoName -Confirm:$false + + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $renamedRepo.name | Should -Be $newRepoName $renamedRepo.PSObject.TypeNames[0] | Should -Be 'GitHub.Repository' } From 2b9e7ff3c03fd22a06ed2dfb8ba2b0e4d151c83c Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 16 Jul 2020 18:53:46 -0700 Subject: [PATCH 06/14] Another update --- Tests/GitHubRepositories.tests.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index b9e35150..f3e472c2 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -707,37 +707,38 @@ try } It "Should have the expected new repository name - by URI" { - $renamedRepo = Rename-GitHubRepository -Uri ($repo.RepositoryUrl) -NewName $newRepoName -Force - # The CI build has beeen unreliable with this test. # Adding a short sleep to ensure successive queries reflect updated state. Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $renamedRepo = Rename-GitHubRepository -Uri ($repo.RepositoryUrl) -NewName $newRepoName -Force $renamedRepo.name | Should -Be $newRepoName } It "Should have the expected new repository name - by Elements" { - $renamedRepo = Rename-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name -NewName $newRepoName -Confirm:$false - # The CI build has beeen unreliable with this test. # Adding a short sleep to ensure successive queries reflect updated state. Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $renamedRepo = Rename-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name -NewName $newRepoName -Confirm:$false $renamedRepo.name | Should -Be $newRepoName } It "Should work via the pipeline" { - $renamedRepo = $repo | Rename-GitHubRepository -NewName $newRepoName -Confirm:$false - # The CI build has beeen unreliable with this test. # Adding a short sleep to ensure successive queries reflect updated state. Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $renamedRepo = $repo | Rename-GitHubRepository -NewName $newRepoName -Confirm:$false $renamedRepo.name | Should -Be $newRepoName $renamedRepo.PSObject.TypeNames[0] | Should -Be 'GitHub.Repository' } It "Should be possible to rename with Set-GitHubRepository too" { + # The CI build has beeen unreliable with this test. + # Adding a short sleep to ensure successive queries reflect updated state. + Start-Sleep -Seconds $script:defaultSleepSecondsForReliability + $renamedRepo = $repo | Set-GitHubRepository -NewName $newRepoName -Confirm:$false $renamedRepo.name | Should -Be $newRepoName $renamedRepo.PSObject.TypeNames[0] | Should -Be 'GitHub.Repository' From eaad9bd79047dfb4f7183f6680fe269a8ea3b66c Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Fri, 17 Jul 2020 06:28:40 -0700 Subject: [PATCH 07/14] Another update --- Tests/Common.ps1 | 2 +- Tests/GitHubAssignees.tests.ps1 | 41 ++++++++++++++++++++++++++++++ Tests/GitHubIssues.tests.ps1 | 2 +- Tests/GitHubLabels.tests.ps1 | 10 ++++---- Tests/GitHubProjects.tests.ps1 | 4 +-- Tests/GitHubRepositories.tests.ps1 | 38 +++++++++++++++------------ 6 files changed, 72 insertions(+), 25 deletions(-) diff --git a/Tests/Common.ps1 b/Tests/Common.ps1 index ecf88b3a..508684b1 100644 --- a/Tests/Common.ps1 +++ b/Tests/Common.ps1 @@ -103,7 +103,7 @@ function Initialize-CommonTestSetup # The number of seconds to sleep after performing some operations to ensure that successive # API calls properly reflect previously updated state. - $script:defaultSleepSecondsForReliability = 1 + $script:defaultSleepSecondsForReliability = 2 } Initialize-CommonTestSetup diff --git a/Tests/GitHubAssignees.tests.ps1 b/Tests/GitHubAssignees.tests.ps1 index 64a694b5..0501f183 100644 --- a/Tests/GitHubAssignees.tests.ps1 +++ b/Tests/GitHubAssignees.tests.ps1 @@ -107,12 +107,22 @@ try Context 'Adding and removing an assignee via parameters' { $issue = $repo | New-GitHubIssue -Title "Test issue" + + # 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 + It 'Should have no assignees when created' { $issue.assignee.login | Should -BeNullOrEmpty $issue.assignees | Should -BeNullOrEmpty } $updatedIssue = Add-GitHubAssignee -OwnerName $script:ownerName -RepositoryName $repo.name -Issue $issue.number -Assignee $owner.login + + # 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 + It 'Should have returned the same issue' { $updatedIssue.number | Should -Be $issue.number } @@ -144,12 +154,22 @@ try Context 'Adding an assignee with the repo on the pipeline' { $issue = $repo | New-GitHubIssue -Title "Test issue" + + # 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 + It 'Should have no assignees when created' { $issue.assignee.login | Should -BeNullOrEmpty $issue.assignees | Should -BeNullOrEmpty } $updatedIssue = $repo | Add-GitHubAssignee -Issue $issue.number -Assignee $owner.login + + # 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 + It 'Should have returned the same issue' { $updatedIssue.number | Should -Be $issue.number } @@ -181,12 +201,22 @@ try Context 'Adding an assignee with the issue on the pipeline' { $issue = $repo | New-GitHubIssue -Title "Test issue" + + # 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 + It 'Should have no assignees when created' { $issue.assignee.login | Should -BeNullOrEmpty $issue.assignees | Should -BeNullOrEmpty } $updatedIssue = $issue | Add-GitHubAssignee -Assignee $owner.login + + # 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 + It 'Should have returned the same issue' { $updatedIssue.number | Should -Be $issue.number } @@ -218,12 +248,22 @@ try Context 'Adding an assignee with the assignee user object on the pipeline' { $issue = $repo | New-GitHubIssue -Title "Test issue" + + # 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 + It 'Should have no assignees when created' { $issue.assignee.login | Should -BeNullOrEmpty $issue.assignees | Should -BeNullOrEmpty } $updatedIssue = $owner | Add-GitHubAssignee -OwnerName $script:ownerName -RepositoryName $repo.name -Issue $issue.number + + # 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 + It 'Should have returned the same issue' { $updatedIssue.number | Should -Be $issue.number } @@ -239,6 +279,7 @@ try } $updatedIssue = $owner | Remove-GitHubAssignee -OwnerName $script:ownerName -RepositoryName $repo.name -Issue $issue.number -Force + It 'Should have returned the same issue' { $updatedIssue.number | Should -Be $issue.number } diff --git a/Tests/GitHubIssues.tests.ps1 b/Tests/GitHubIssues.tests.ps1 index 48a1d6b0..1cff5d0c 100644 --- a/Tests/GitHubIssues.tests.ps1 +++ b/Tests/GitHubIssues.tests.ps1 @@ -550,7 +550,7 @@ try Lock-GitHubIssue -OwnerName $script:OwnerName -RepositoryName $repo.name -Issue $issue.number - # The CI build has beeen unreliable with this test. + # 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 diff --git a/Tests/GitHubLabels.tests.ps1 b/Tests/GitHubLabels.tests.ps1 index 899d543e..83fd9e93 100644 --- a/Tests/GitHubLabels.tests.ps1 +++ b/Tests/GitHubLabels.tests.ps1 @@ -81,7 +81,7 @@ try $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName - # The CI build has beeen unreliable with this test. + # 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 @@ -332,7 +332,7 @@ try Context 'Removing a label with parameters' { $label = $repo | New-GitHubLabel -Label 'test' -Color 'CCCCCC' - # The CI build has beeen unreliable with this test. + # 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 @@ -346,7 +346,7 @@ try Context 'Removing a label with the repo on the pipeline' { $label = $repo | New-GitHubLabel -Label 'test' -Color 'CCCCCC' - # The CI build has beeen unreliable with this test. + # 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 @@ -360,7 +360,7 @@ try Context 'Removing a label with the name on the pipeline' { $label = $repo | New-GitHubLabel -Label 'test' -Color 'CCCCCC' - # The CI build has beeen unreliable with this test. + # 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 @@ -374,7 +374,7 @@ try Context 'Removing a label with the label object on the pipeline' { $label = $repo | New-GitHubLabel -Label 'test' -Color 'CCCCCC' - # The CI build has beeen unreliable with this test. + # 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 diff --git a/Tests/GitHubProjects.tests.ps1 b/Tests/GitHubProjects.tests.ps1 index f4261a7b..3417c1d4 100644 --- a/Tests/GitHubProjects.tests.ps1 +++ b/Tests/GitHubProjects.tests.ps1 @@ -611,7 +611,7 @@ try $project = New-GitHubProject -OwnerName $script:ownerName -RepositoryName $repo.name -ProjectName $defaultRepoProject -Description $defaultRepoProjectDesc $null = Remove-GitHubProject -Project $project.id -Confirm:$false It 'Project should be removed' { - # The CI build has beeen unreliable with this test. + # 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 @@ -623,7 +623,7 @@ try $project = $repo | New-GitHubProject -ProjectName $defaultRepoProject -Description $defaultRepoProjectDesc $project | Remove-GitHubProject -Force It 'Project should be removed' { - # The CI build has beeen unreliable with this test. + # 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 diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index f3e472c2..6961a6ea 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -126,7 +126,7 @@ try } $repo = New-GitHubRepository @newGitHubRepositoryParms - # The CI build has beeen unreliable with this test. + # 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 } @@ -311,7 +311,7 @@ try $templateRepo = New-GitHubRepository @newGitHubRepositoryParms - # The CI build has beeen unreliable with this test. + # 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 } @@ -330,7 +330,7 @@ try $repo = New-GitHubRepositoryFromTemplate @newGitHubRepositoryFromTemplateParms - # The CI build has beeen unreliable with this test. + # 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 } @@ -374,7 +374,7 @@ try $repo = $templateRepo | New-GitHubRepositoryFromTemplate @newGitHubRepositoryFromTemplateParms - # The CI build has beeen unreliable with this test. + # 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 } @@ -499,7 +499,8 @@ try } It "Should return the correct membership order" { - for ($i = 1; $i -le $sortedRepos.count; $i++) { + for ($i = 1; $i -le $sortedRepos.count; $i++) + { $sortedRepos[$i].full_name | Should -Be $sortedRepoFullNames[$i] $sortedDescendingRepos[$i].full_name | Should -Be $sortedDescendingRepoFullNames[$i] } @@ -541,7 +542,8 @@ try } It 'Should return the correct properties' { - foreach ($repo in $repos) { + foreach ($repo in $repos) + { $repo.owner.login | Should -Be $ownerName } } @@ -598,6 +600,10 @@ try } $repo = New-GitHubRepository @newGitHubRepositoryParms + + # 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 } Context 'When specifiying the Uri parameter' { @@ -674,7 +680,7 @@ try It 'Should get no content using -Confirm:$false' { Remove-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name -Confirm:$false - # The CI build has beeen unreliable with this test. + # 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 @@ -684,7 +690,7 @@ try It 'Should get no content using -Force' { Remove-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name -Force - # The CI build has beeen unreliable with this test. + # 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 @@ -701,13 +707,13 @@ try $suffixToAddToRepo = "_renamed" $newRepoName = "$($repo.name)$suffixToAddToRepo" - # The CI build has beeen unreliable with this test. + # 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 } It "Should have the expected new repository name - by URI" { - # The CI build has beeen unreliable with this test. + # 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 @@ -716,7 +722,7 @@ try } It "Should have the expected new repository name - by Elements" { - # The CI build has beeen unreliable with this test. + # 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 @@ -725,7 +731,7 @@ try } It "Should work via the pipeline" { - # The CI build has beeen unreliable with this test. + # 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 @@ -735,7 +741,7 @@ try } It "Should be possible to rename with Set-GitHubRepository too" { - # The CI build has beeen unreliable with this test. + # 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 @@ -910,7 +916,7 @@ try It 'Should be removable by the pipeline' { ($repo | Remove-GitHubRepository -Confirm:$false) | Should -BeNullOrEmpty - # The CI build has beeen unreliable with this test. + # 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 @@ -950,7 +956,7 @@ try It 'Should be removable by the pipeline' { ($repo | Remove-GitHubRepository -Confirm:$false) | Should -BeNullOrEmpty - # The CI build has beeen unreliable with this test. + # 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 @@ -1025,7 +1031,7 @@ try BeforeAll { $repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) - # The CI build has beeen unreliable with this test. + # 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 From 1339ce862bef4cba2ff3c065ddd030a723338f41 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Fri, 17 Jul 2020 07:55:20 -0700 Subject: [PATCH 08/14] Another update --- Tests/Common.ps1 | 2 +- Tests/GitHubRepositories.tests.ps1 | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Tests/Common.ps1 b/Tests/Common.ps1 index 508684b1..41253602 100644 --- a/Tests/Common.ps1 +++ b/Tests/Common.ps1 @@ -103,7 +103,7 @@ function Initialize-CommonTestSetup # The number of seconds to sleep after performing some operations to ensure that successive # API calls properly reflect previously updated state. - $script:defaultSleepSecondsForReliability = 2 + $script:defaultSleepSecondsForReliability = 3 } Initialize-CommonTestSetup diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index 6961a6ea..7e1c1306 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -751,6 +751,10 @@ try } AfterEach -Scriptblock { + # 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 + Remove-GitHubRepository -Uri "$($repo.svn_url)$suffixToAddToRepo" -Confirm:$false } } From 41a2c3461c2541ced95051f8b5489ada9b9f8901 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Fri, 17 Jul 2020 08:55:02 -0700 Subject: [PATCH 09/14] Another update --- Tests/GitHubRepositories.tests.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index 7e1c1306..e49038f0 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -1318,6 +1318,10 @@ try Describe 'GitHubRepositories\Enable-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 } Context 'When Enabling GitHub Repository Vulnerability Alerts' { @@ -1353,6 +1357,10 @@ try Describe 'GitHubRepositories\Enable-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 } Context 'When Enabling GitHub Repository Security Fixes' { From de13e356e3452cf62f2f76a75607aed4541f8a5b Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Fri, 17 Jul 2020 11:40:42 -0700 Subject: [PATCH 10/14] More updates --- Tests/GitHubRepositories.tests.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index e49038f0..c5c6bc14 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -419,6 +419,10 @@ try BeforeAll { $publicRepo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) $privateRepo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) -Private + + # 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 } Context 'When specify the visibility parameter' { @@ -552,6 +556,10 @@ try Context 'When getting a repository for a specified organization' { BeforeAll { $repo = New-GitHubRepository -OrganizationName $script:organizationName -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 } It "Should have results for the organization" { @@ -569,6 +577,10 @@ try $repo1 = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) $repo2 = 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 + $repos = Get-GitHubRepository -GetAllPublicRepositories -Since $repo1.id } From 05d7fae191ea868105b011a6595bbc4656e065e8 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Fri, 17 Jul 2020 12:46:43 -0700 Subject: [PATCH 11/14] More updates --- Tests/GitHubRepositories.tests.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index c5c6bc14..5ea84b12 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -778,6 +778,10 @@ try BeforeAll -ScriptBlock { $repoName = ([Guid]::NewGuid().Guid) $repo = New-GitHubRepository -RepositoryName $repoName + + # 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 } Context -Name 'When updating a repository with all possible settings' { @@ -797,6 +801,7 @@ try DeleteBranchOnMerge = $true IsTemplate = $true } + $updatedRepo = Set-GitHubRepository @updateGithubRepositoryParms } @@ -829,6 +834,7 @@ try DisallowMergeCommit = $false DisallowRebaseMerge = $true } + $updatedRepo = Set-GitHubRepository @updateGithubRepositoryParms } @@ -851,6 +857,7 @@ try RepositoryName = $repoName Archived = $true } + $updatedRepo = Set-GitHubRepository @updateGithubRepositoryParms } @@ -877,11 +884,16 @@ try $repoName = ([Guid]::NewGuid().Guid) $repo = New-GitHubRepository -RepositoryName $repoName -Private + # 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 + $updateGithubRepositoryParms = @{ OwnerName = $repo.owner.login RepositoryName = $repoName Private = $false } + $updatedRepo = Set-GitHubRepository @updateGithubRepositoryParms } From 50d8a857e1553ccc2a24a431c580d5ccbd3a98d0 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Fri, 17 Jul 2020 13:43:28 -0700 Subject: [PATCH 12/14] Another update --- Tests/GitHubRepositoryForks.tests.ps1 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Tests/GitHubRepositoryForks.tests.ps1 b/Tests/GitHubRepositoryForks.tests.ps1 index cfc9aeb3..b4cd6f46 100644 --- a/Tests/GitHubRepositoryForks.tests.ps1 +++ b/Tests/GitHubRepositoryForks.tests.ps1 @@ -29,6 +29,10 @@ try Context 'When a new fork is created' { BeforeAll { $repo = New-GitHubRepositoryFork -OwnerName $script:upstreamOwnerName -RepositoryName $script:upstreamRepositoryName + + # 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 } AfterAll { @@ -54,6 +58,10 @@ try BeforeAll { $upstream = Get-GitHubRepository -OwnerName $script:upstreamOwnerName -RepositoryName $script:upstreamRepositoryName $repo = $upstream | New-GitHubRepositoryFork + + # 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 } AfterAll { @@ -80,12 +88,13 @@ try Context 'When a new fork is created' { BeforeAll { $repo = New-GitHubRepositoryFork -OwnerName $script:upstreamOwnerName -RepositoryName $script:upstreamRepositoryName -OrganizationName $script:organizationName - } - AfterAll { - # Trying to avoid an issue with deleting the repo if it's still being created by GitHub + # 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 + } + AfterAll { $repo | Remove-GitHubRepository -Force } From fb1fc37cdcc1450927730f167e18150f89f4686a Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Fri, 17 Jul 2020 14:40:46 -0700 Subject: [PATCH 13/14] More updates --- Tests/GitHubLabels.tests.ps1 | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Tests/GitHubLabels.tests.ps1 b/Tests/GitHubLabels.tests.ps1 index 83fd9e93..8c635f0f 100644 --- a/Tests/GitHubLabels.tests.ps1 +++ b/Tests/GitHubLabels.tests.ps1 @@ -209,6 +209,10 @@ try BeforeAll { $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName + + # 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 } AfterAll { @@ -323,6 +327,10 @@ try BeforeAll { $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName + + # 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 } AfterAll { @@ -390,6 +398,10 @@ try BeforeAll { $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName + + # 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 } AfterAll { @@ -567,6 +579,10 @@ try BeforeAll { $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName + + # 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 } AfterAll { @@ -641,6 +657,11 @@ try BeforeAll { $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName + + # 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 + $repo | Initialize-GitHubLabel -Label $defaultLabels } @@ -869,6 +890,11 @@ try BeforeAll { $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName + + # 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 + $repo | Initialize-GitHubLabel -Label $defaultLabels } @@ -935,6 +961,11 @@ try BeforeAll { $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName + + # 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 + $repo | Initialize-GitHubLabel -Label $defaultLabels } @@ -1102,6 +1133,11 @@ try BeforeAll { $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName + + # 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 + $repo | Initialize-GitHubLabel -Label $defaultLabels } @@ -1251,6 +1287,11 @@ try BeforeAll { $repositoryName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repositoryName + + # 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 + $repo | Initialize-GitHubLabel -Label $defaultLabels $milestone = $repo | New-GitHubMilestone -Title 'test milestone' From 4ad01f0d2ab2cf5e5fcec1259d452efc63548c2a Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Fri, 17 Jul 2020 17:31:24 -0700 Subject: [PATCH 14/14] Another update --- Tests/GitHubContents.tests.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/GitHubContents.tests.ps1 b/Tests/GitHubContents.tests.ps1 index c1b9661e..a52ed473 100644 --- a/Tests/GitHubContents.tests.ps1 +++ b/Tests/GitHubContents.tests.ps1 @@ -37,6 +37,10 @@ try BeforeAll { # AutoInit will create a readme with the GUID of the repo name $repo = New-GitHubRepository -RepositoryName ($repoGuid) -AutoInit + + # 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 } AfterAll { @@ -260,6 +264,10 @@ try $repoName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repoName -AutoInit + + # 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 } Context 'When setting new file content' {