aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/git_helper_for_declarative_test.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-12-15 16:21:16 +0000
committerGitHub <noreply@github.com>2019-12-15 16:21:16 +0000
commit60b31c8f01cbfdad5435510a9b8b05f84fe38a78 (patch)
tree388b4f789866e6908f4ad9444e08ee1e982272b4 /integrations/git_helper_for_declarative_test.go
parentf6b29012e09d5f7770a0b1ea8659da5172e155b3 (diff)
downloadgitea-60b31c8f01cbfdad5435510a9b8b05f84fe38a78.tar.gz
gitea-60b31c8f01cbfdad5435510a9b8b05f84fe38a78.zip
Fix the intermittent TestGPGGit failures (#9360)
* Fix the intermittent TestGPGGit failures Reattempt to open the listener if the port is busy with a delay up to a second Switch from generating a private key each time, just use a known good key
Diffstat (limited to 'integrations/git_helper_for_declarative_test.go')
-rw-r--r--integrations/git_helper_for_declarative_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/integrations/git_helper_for_declarative_test.go b/integrations/git_helper_for_declarative_test.go
index b334c55d3c..5838b9e512 100644
--- a/integrations/git_helper_for_declarative_test.go
+++ b/integrations/git_helper_for_declarative_test.go
@@ -87,6 +87,12 @@ func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL), prepare ...bo
u, err := url.Parse(setting.AppURL)
assert.NoError(t, err)
listener, err := net.Listen("tcp", u.Host)
+ i := 0
+ for err != nil && i <= 10 {
+ time.Sleep(100 * time.Millisecond)
+ listener, err = net.Listen("tcp", u.Host)
+ i++
+ }
assert.NoError(t, err)
u.Host = listener.Addr().String()